
If you ask someone to double a number, they'll come back to you and tell you twice the number you gave them - give the "3" and they'll say "6". But if you tell them to double the number every time they handle it, but refer it to someone else for them to validate it, you'll get "12" back. Since they will double it each time they pass it on. And if the person they validated it with also doubles it, you'll get "24".
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.
(written 2008-12-14)
Associated topics are indexed under
A655 - Web Application Deployment - Using Tomcat and Apache httpd Together [3999] Handling failures / absences of your backend server nicely - (2013-02-08)
[3018] Tuning Apache httpd and Tomcat to work well together - (2010-10-27)
[2482] Load balancing with sticky sessions (httpd / Tomcat) - (2009-10-29)
[1944] Forwarding session and cookie requests from httpd to Tomcat - (2008-12-14)
[1938] Predictive Load Balancing - PHP and / or Java - (2008-12-13)
[1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
[1552] Extra public classes in deploying Apache httpd and Tomcat - (2008-02-24)
[1549] http, https and ajp - comparison and choice - (2008-02-22)
[1383] Monitoring mod_jk and how it is load balancing - (2007-10-07)
[1376] Choosing between mod_proxy and mod_rewrite - (2007-10-02)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[576] Why run two different web servers - (2006-01-25)
[436] Linking Apache httpd to Apache Tomcat - (2005-09-05)
A657 - Web Application Deployment - Using httpd to front Tomcat [2483] Clustering on Tomcat - (2009-10-30)
[1939] mod_proxy_ajp and mod_proxy_balancer examples - (2008-12-13)
[1566] Strange behaviour of web directory requests without a trailing slash - (2008-03-06)
[1377] Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02)
3c16
Some other Articles
Port and GlassesChristmas scenes and eventsServer - Service - Engine - Host, TomcatURL rewriting with front and back serversGetting hold of the wrong end of the stickQuick Summary - PHP installationSummary of MySQL installation on a Linux system