Recipe 11.12 Sharing Load Between Servers Using mod_proxy


You want to have a certain subset of your web site served from another machine, in order to share the load of the site.


Use ProxyPass and ProxyPassReverse to have Apache fetch the content from another server:

ProxyPass        /other/ ProxyPassReverse /other/


These directives will cause requests to URLs starting with /other/ to be forwarded to the server, with the path information preserved. That is to say, a request for will be translated into a request for Content obtained from this other server will be returned to the client, which will be unable to determine that any such technique was employed. The ProxyPassReverse directive ensures that any redirect headers sent from the backend server (in this case, will be modified so that they appear to come from the main server.

This method is often used to have the dynamic portion of the site served by a server running mod_perl often even on the same machine, but on a different port while the static portions of the site are served from the main server, which can be lighter weight, and so run faster.

Note that URLs contained within documents are not rewritten as they pass through the proxy, and links within documents should be relative, rather than absolute, so that they work correctly.

See Also



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: