Tomcat 9 – Configure as Proxy for Internal Web Server

PROXYtomcatUbuntuweb-hostingweb-server

I have a web application on a server that uses Tomcat 9. It has been set up for one web application, and has certificates and domain etc. Now I have another server on the network, that hosts another application. It has been an internal tool until now, and now it needs to be accessible from the internet. Unfortunately another certificate and domain costs an absolute ridiculous amount of money for some reason, and now I am looking if I could set up the Tomcat to serve the other (normal LAMP) server and act as a proxy, so that when accessing a certain url, for example tomcatserver.example/lampserver etc. Tomcat would proxy the traffic to the other server.

Both servers run Ubuntu, and I have root privileges if necessary. I can also ask the server provider to open ports to the internet.

Best Answer

Tomcat does not have support for acting as a reverse proxy.

If the second server is a LAMP server then httpd can act as a reverse proxy. It would be worth considering reorganising things so the LAMP server uses the domain and certificate and then proxies requests to the Tomcat instance as required.