1

I've configured an Apache server with SSL and reverse proxy to a tomcat

<VirtualHost domain.com:1443>
[...]
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://local.com:8080/
ProxyPassReverse / http://local.com:8080

SSLEngine on
[...]
</VirtualHost>

Tomcat is listening on 8080. The issue is that the app on tomcat is redirecting the request (HTTP 302 Moved temporairly). For example, if I use the URL https:// domain.com:1443/folder, reverse proxy launch the request http:// local.com:8080/folder, then, the app redirect to "/subfolder", so the final request is: http://domain.com:1443/folder/subfolder. Result is a 400 Bad request error code, as the request is HTTP on my SSL port.

Do you know how I can fix this issue ?

Thanks in advance.

  • You have to configure/modify your tomcat app, so that it redirects to https, not to http, when the original request was https too. – Krist van Besien Jun 30 '13 at 8:51
0

Instead of plain http proxy, use proxy_ajp. Adapt the example below to match your needs, i.e. it is up to you to proxy everything to the container or only a namespace:

ProxyRequests off
ProxyPassMatch ^/(your_app)(.*) ajp://localhost:8009/$1$2 ttl=120 ping=1

Ensure that server.xml in your tomcat configuration includes an AJP listener. The executor is optional.

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
          maxThreads="150" minSpareThreads="4"/>

<Connector executor="tomcatThreadPool"
           port="8009" protocol="AJP/1.3"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" />
  • Yes I thinked to do this but I have a requirement to use HTTP instead of AJP... – John Q Jun 29 '13 at 20:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.