I've configured an infrastructre setup where an apache reverse proxy terminates SSL requests. Then the requests are proxied to another frontend apache webserver and then again this one is connected via mod_jk/AJP to a tomcat. The setup seems to run smoothly without one exception. The tomcat serves WSDL webservices and in these XML files one tag includes the host location which should be identical to the requested URL.
Due the current setup the host location represents the internal URL of the (ajp connected) frontend webserver and not the requested external URL. A first attempt to solve this issue was to disposit the external URL as a proxy URL within tomcats server.xml but this method isn't aware of HTTP or HTTPS requests. I've to determine one.
Further the services are also currently accessible over other frontend servers with completely other URLs (a more simple setup without a reverse proxy).
I hope I've described my problem comprehensible. How can I make the tomcat aware of the requested URL or maybe should I pass the requested URL to the frontend apache? I'm a little bit stuck at the moment.
Thanks in advance.
A short overview of the request sequence:
**customerX** -- REQUEST HTTP|HTTPS -- **host.external/customerX** -- PASS HTTP -- **customerX.internal** -- AJP -- **tomcat**
ProxyPreserveHost On doesn't do the trick because it passes host.external to the frontend apache and there's no virtual host that matches this virtual host which leads to an 404 error - self-explanatory.
The config isn't special at all. The external accessible reverse proxy has 2 virtual hosts (HTTP|HTTPS). Both virtual hosts are aware of each customer we serve over the context /customerX, /customerY and so on. E.g. the HTTP virtual host:
<VirtualHost *:80> ServerName host.external ProxyPass /customerX http://customerX.internal ProxyPassReverse /customerX http://customerX.internal ProxyPass /customerY http://customerY.internal ProxyPassReverse /customerY http://customerY.internal ... </VirtualHost>
I know, the second line is implicit.
On the second apache there's one virtual host (HTTP only) for each customer with the correspondending server name and the necessery JkMounts for tomcats webapps:
<VirtualHost *:80> ServerName customerX.internal JkMount ... </VirtualHost>