O'Reilly logo

Apache Cookbook by Rich Bowen, Ken Coar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required