0

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.

/edit

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>
  • Are you using ProxyPreserveHost Yes? Can you add the relevant pieces of configuration to your question? – dawud May 17 '14 at 8:05
  • Edit this so the goal is clear, and what isn't working is clear. So you are using http proxy from one Apache instance to another, and then from the second Apache proxy to Tomcat using AJP protocol? You may need to add a rewrite to https in some part of the config chain or use https scheme. – Schrute May 24 '14 at 16:52
  • Try to get rid of ajp and just use http on tomcat and use mod_proxy in Apache for the last part of the sequence. – Schrute Jun 25 '14 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.