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.
This module was experimental in Apache 1.1.x. As of Apache 1.2, mod_proxy stability is greatly improved.
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.
ProxyRequests Off
This allows or prevents Apache from functioning as a proxy server. Setting ProxyRequests to 'off' does not disable use of the ProxyPass directive.
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:8080In the last example, the proxy will forward FTP requests, encapsulated as yet another HTTP proxy request, to another proxy which can handle them.
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.comwill 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>.
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.comwill 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