---
title: Using Apache as a reverse‑proxy
description: Learn how to use Apache as a reverse proxy to streamline your development process by mirroring static files and accessing JSON data efficiently.
---

[Blog ](https://www.metaltoad.com/blog)

# [Using Apache as a reverse‑proxy](https://www.metaltoad.com/blog/using-apache-reverse-proxy)

 Written by [Metal Toad Staff](https://www.metaltoad.com/blog/author/metal-toad-staff) | Mar 4, 2011 12:00:00 AM

Apache includes the ability to function as a reverse proxy, which means it can be directed to delegate certain requests to another server. I've found two useful applications for [mod_proxy](http://httpd.apache.org/docs/2.0/mod/mod_proxy.html) recently: mirroring static files from production, and accessing JSON data.

### Static files on a Drupal development server

If your `files` directory is large, it may be impractical to replicate it on a development server. Instead, you can ask Apache to proxy requests for any missing files to the production server.

```
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /sites/default/files
RewriteRule ^(.*)$ http://www.example.com/$1 [P,L]
```

The "P" flag after a `RewriteRule` creates a proxy, and "L" indicates that processing should stop after this rule. Note this will prevent ImageCache from generating new derivatives on the development site.

### Connecting browsers to 3rd-party JSON data

One of the great things about JSON encoding is the data can easily be consumed directly in a browser. You don't need glue code in your application, or (horrors) an SDK. You do however need to deal with the browser's [same-origin policy](https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript).

On the FontFuse project, we solved this by creating a simple proxy:

```
RewriteRule (.*serviceapi/webink/.*) http://www.extensis.com/$1 [P,L]
```

In production, we're using Varnish to allow caching of common requests, but this simple proxy enables development copies of the site to run without additional services.

[View full post](https://www.metaltoad.com/blog/using-apache-reverse-proxy)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Metal Toad Staff"
  },
  "dateModified" : "2025-04-25T04:31:13.840Z",
  "datePublished" : "2011-03-04T00:00:00Z",
  "headline" : "Using Apache as a reverse‑proxy",
  "image" : {
    "@type" : "ImageObject",
    "height" : 500,
    "url" : "https://6104926.fs1.hubspotusercontent-na1.net/hubfs/6104926/Imported_Blog_Media/Metal_Toad_blog_generic-Aug-11-2023-10-24-31-3278-PM.jpg",
    "width" : 870
  },
  "mainEntityOfPage" : "https://www.metaltoad.com/blog/using-apache-reverse-proxy",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60.0,
      "url" : "https://6104926.fs1.hubspotusercontent-na1.net/hubfs/6104926/social-suggested-images/6104926.fs1.hubspotusercontent-na1.nethub6104926hubfsMetal_Toad_Logo_orange_horizontal-50-1.jpg",
      "width" : 240.00002
    },
    "name" : "Blog"
  }
}
```