Forum Moderators: phranque
Web1
proprietry Webserver Port 80
acts as Proxy for the rootcontext of Web2 (Port 82)
Web2
Apache Port 82
acts as Proxy für three more URL's of Web3
(hosts more Ports)
Web3
a tomcat
3 contexts on Ports 6668, 7668, 8668
Problem:
If we call "http://www.server.com/app1" on Web1, then Web1 calls Web2 (Apache) with [server.com:82...] and web2 itself calls web3 (Tomcat) [server.com:8668...]
Ok ... now, behind the WebApp "app1" on web3 (Tomcat) is a servlet which redirects the request to "http://www.server.com:8668/app1/index.jsp".
The ProxyPassReverse entry takes care of this port and reewrites the URL: [server.com:82...]
The problem no is web1 - which is proprietry and does not know about ProxyReversing, so the inital call to
"http://www.server.com/app1" comes up with "http://www.server.com:82/app1/index.jsp" and so the client connects to web2 port 82 instead of web1 port 80.
I have posted the httpd.conf of web2 for you to check on this. The config does work, but with the described problems. If I remove the Reverse entries it gets even worse, becourse then the client gets ""http://www.server.com:8668/app1/index.jsp"!
I tried to write a RewriteRule (see config) that would rewrite "www.server.com:82" to "www.server.com" - but this only works for this one URL: "http://www.server.com:82/" ... generates "http://www.server.com/"
But does not work for ie. "http://www.server.com/app1" it still comes up with "http://www.server.com:82/app1/index.jsp"
It seems, that the RewriteRoule does not get applied in Reverse ...
Even that RewriteRule in my oppinion has a race condition - the calls from "www.server.com:80" actually are request to "www.server.com:82" - which would trigger the rewrite, forcing the request to be bounced back to :80 and so on ...
strange enough that does not happen ...
AND ... it does work if no rewrite takes place. ie. if we enter the whole correct URL:
"http://www.server.com/app1/index.jsp"
this stays:
"http://www.server.com/app1/index.jsp"
The ProxyReverse does not have to do anything
# rewrite environment
RewriteEngine on
RewriteLog /usr/apache/logs/https_rewrite_log
RewriteLogLevel 5
RewriteCond %{HTTP_HOST}^www.server.com:82$[NC]
RewriteRule (.*)$http://www.server.com$1[R]
<IfModule mod_proxy.c>
NoCache*
ProxyRequestsOff
ProxyReceiveBufferSize0
ProxyIOBufferSize0
ProxyViaOff
ProxyPass /app1 [server.com:8668...]
ProxyPass /app2 [server.com:7668...]
ProxyPass /app3 [server.com:6668...]
ProxyPassReverse / [server.com:6668...]
ProxyPassReverse / [server.com:7668...]
ProxyPassReverse / [server.com:8668...]
</IfModule>