[APACHE DOCUMENTATION]

Apache HTTP Server Version 1.3

Apache module mod_proxy

This module is contained in the mod_proxy.c file for Apache 1.1.x, or the modules/proxy subdirectory for Apache 1.2, and is not compiled in by default. It provides for an HTTP 1.0 caching proxy server. It is only available in Apache 1.1 and later. Common configuration questions are addressed after the directive descriptions.

Note:

This module was experimental in Apache 1.1.x. As of Apache 1.2, mod_proxy stability is greatly improved.

Summary

This module implements a proxy/cache for Apache. It implements proxying capability for FTP, CONNECT (for SSL), HTTP/0.9, and HTTP/1.0. The module can be configured to connect to other proxy modules for these and other protocols.

Directives


ProxyRequests

Syntax: ProxyRequests on/off
Default: ProxyRequests Off
Context: server config, virtual host
Override: Not applicable
Status: Base
Module: mod_proxy
Compatibility: ProxyRequests is only available in Apache 1.1 and later.

This allows or prevents Apache from functioning as a proxy server. Setting ProxyRequests to 'off' does not disable use of the ProxyPass directive.


ProxyRemote

Syntax: ProxyRemote <match> <remote-server>
Default: None
Context: server config, virtual host
Override: Not applicable
Status: Base
Module: mod_proxy
Compatibility: ProxyRemote is only available in Apache 1.1 and later.

This defines remote proxies to this proxy. <match> is either the name of a URL-scheme that the remote server supports, or a partial URL for which the remote server should be used, or '*' to indicate the server should be contacted for all requests. <remote-server> is a partial URL for the remote server. Syntax:

  <remote-server> = <protocol>://<hostname>[:port]
<protocol> is the protocol that should be used to communicate with the remote server; only "http" is supported by this module.

Example:

  ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000
  ProxyRemote * http://cleversite.com
  ProxyRemote ftp http://ftpproxy.mydomain.com:8080
In the last example, the proxy will forward FTP requests, encapsulated as yet another HTTP proxy request, to another proxy which can handle them.

ProxyPass

Syntax: ProxyPass <path> <url>
Default: None
Context: server config, virtual host
Override: Not applicable
Status: Base
Module: mod_proxy
Compatibility: ProxyPass is only available in Apache 1.1 and later.

This directive allows remote servers to be mapped into the space of the local server; the local server does not act as a proxy in the conventional sense, but appears to be a mirror of the remote server. <path> is the name of a local virtual path; <url> is a partial URL for the remote server.

Suppose the local server has address http://wibble.org/; then

   ProxyPass /mirror/foo http://foo.com
will cause a local request for the <http://wibble.org/mirror/foo/bar> to be internally converted into a proxy request to <http://foo.com/bar>.

ProxyPassReverse

Syntax: ProxyPassReverse <path> <url>
Default: None
Context: server config, virtual host
Override: Not applicable
Status: Base
Module: mod_proxy
Compatibility: ProxyPassReverse is only available in Apache 1.3b6 and later.

This directive lets Apache adjust the URL in the Location header on HTTP redirect responses. For instance this is essential when Apache is used as a reverse proxy to avoid by-passing the reverse proxy because of HTTP redirects on the backend servers which stay behind the reverse proxy.

<path> is the name of a local virtual path.
<url> is a partial URL for the remote server - the same way they are used for the ProxyPass directive.

Example:
Suppose the local server has address http://wibble.org/; then

   ProxyPass         /mirror/foo http://foo.com
   ProxyPassReverse  /mirror/foo http://foo.com
will not only cause a local request for the <http://wibble.org/mirror/foo/bar> to be internally converted into a proxy request to <http://foo.com/bar> (the functionality ProxyPass provides here). It also takes care of redirects the server foo.com sends: when http://foo.com/bar is redirected by him to http://foo.com/quux Apache adjusts this to http://wibble.org/mirror/foo/quux before forwarding the HTTP redirect response to the client.

Note that this ProxyPassReverse directive can also by used in conjunction with the proxy pass-through feature ("RewriteRule ... [P]") from mod_rewrite