Chapter 10. Proxies

Proxy means to act on behalf of another. In the context of a web server, this means one server fetching content from another server, then returning it to the client. For example, you may have several web servers that hide behind a proxy server. The proxy server is responsible for having requests end up going to the right backend server.

mod_proxy , which comes with Apache, handles proxying behavior. The recipes in this chapter cover various techniques that can be used to take advantage of this capability. We discuss securing your proxy server, caching content proxied through your server, and ways to use mod_proxy to map requests to services running on alternate ports.

Additional information about mod_proxy can be found at http://httpd.apache.org/docs/mod/mod_proxy.html for Apache 1.3, or http://httpd.apache.org/docs-2.0/mod/mod_proxy.html for Apache 2.0.

Please make sure you don’t enable proxying until you understand the security concerns involved and have taken steps to secure your proxy server. (See Recipe 6.20 for details.)

You may also wish to consider a dedicated proxy server, such as Squid (http://www.squid-cache.org/), which is focused entirely on one task, and thus has more options related to this task.

10.1. Securing Your Proxy Server

Problem

You want to enable proxying, but you don’t want an open proxy that can be used by just anyone at all.

Solution

For Apache 1.3:

<Directory proxy:*>
    Order deny,allow
    Deny from all
    Allow from .yourdomain.com
</Directory>

Get Apache Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.