Hiding the Backend Servers


ProxyPass /crm http://crm.example.com ProxyPassReverse /crm http://crm.example.com ProxyErrorOverride On


During the process described in the previous section, the client has only contacted the reverse proxy server and is unaware of the existence of the backend servers. Sometimes, however, the backend server will issue redirects or error pages that contain references to itself, for example in the Location: header.

The ProxyPassReverse directive will intercept these headers and rewrite them so that they include a reference to the reverse proxy (www.example.com) instead. The ProxyPassReverseCookiePath and ProxyPassReverseCookieDomain directives operate similarly, but on the path and domain strings in Set-Cookie: headers.

Additionally, ProxyErrorOverride, which is only available in Apache 2, will allow you to display the error pages of the proxy server, replacing the error pages received from the backend. This enables you to further hide the existence of that backend server and provide a consistent frontend, even for error messages.

Note

Note that the ProxyPassReverse directive operates only at the HTTP header level. It will not inspect or rewrite links inside HTML documents. For that purpose, you can use mod_proxy_html, an Apache 2 module that allows you to parse the documents being served through the proxy and rewrite the HTML on the fly. You can download it from http://apache.webthing.com/mod_proxy_html/.





Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net