I have a problem with configuring Apache 2 reverse proxy for Tomcat 8.
I have a server that has two Tomcat instances running, old Tomcat 7 and recently installed Tomcat 8. Tomcat 7 has a HTTP connector configured in its server.xml and it uses the port 8080, the configuration looks like this:
<Connector port="8080" protocol="HTTP/1.1"
maxThreads="200"
clientAuth="false"
URIEncoding="UTF-8"
useBodyEncodingForURI="true"
scheme="http"/>
Tomcat 8 has a HTTP connector configured in its server.xml and it uses the port 8765 with the same configuration as above, just a different port.
Tomcat 7 has a REST API running in webapps/api
Tomcat 8 has a REST API running in webapps/anotherapi
The server also has Apache 2 working as a reverse proxy and it listens to port 443. The reverse proxy configuration part in ssl.conf looks like this:
<VirtualHost _default_:443>
ServerName my.server.com:443
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
ProxyRequests Off
SSLProxyVerify none
SSLProxyCheckPeerCN off
ProxyPass /api http://localhost:8080/api
ProxyPassReverse /api http://localhost:8080/api
ProxyPass /anotherapi http://localhost:8765/anotherapi
ProxyPassReverse /anotherapi http://localhost:8765/anotherapi
#configuration truncated
</VirtualHost>
Tomcat 7 and its reverse proxy configuration have been on the server for quite a while and it works normally, but problems occur with the new Tomcat 8.
When I try to GET https://my.server.com/api/someresource on my browser I get the expected response from my REST API on Tomcat 7, however when I try to access https://my.server.com/anotherapi/someresource I get HTTP status 404 page returned from Tomcat 7 instead of the expected response from Tomcat 8.
Any ideas why this happens? Is there something else I need to do when dealing with two Tomcat instances?
SSL module is loaded in Apache and there shouldn't be problems with my certificate.