URL rewriting with front and back servers
Archive - Originally posted on "The Horse's Mouth" - 2008-12-14 06:16:32 - Graham Ellis
If you're calling up a web page from a Tomcat Server that's running an application behind an Httpd server, you need to make sure that your URLs don't get rewritten two or three times in this fashion - but rather they get processed each step along the way in such a fashion that the report back to the browser is the correct one. Using httpd's mod_proxy it is especially easy to get the rewriting wrong, though.
The diagram here shows each of the three steps where URL re-writing may happen with mod_proxy:
1. On the way in through httpd, as set up by the ProxyPass directive
2. At Tomcat, as defined by the proxyName and proxyPort attributes of the <Connector>
3. On the way back through httpd, as per the ProxyPassReverse directive
My own suggestion is to KISS ("Keep is Simple, Stupid!"). Leave off proxyName and proxyPort attributes on the Tomcat Connector, and have the ProxyPass and ProxyPassReverse set to be equal but opposite.