FreeKB - Tomcat proxy pass setup
Tomcat - proxy pass setup

One way to serve a Tomcat application is to have clients request the application directly from the Tomcat server.


In this example, the client requests direct from Tomcat, and then Tomcat sends the application to the client.


A web server can be configured as a proxy server, so that the clients will request the Tomcat application from the web server, and then the web server will get the application from Tomcat, and the web server will send the Tomcat application to the client. 


As an example, if the webserver is HTTPD, you would add the following markup to the server.xml file.

<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />


Assuming HTTPD is configured to use virtual hosts, add Proxy and ProxyPass to the /etc/httpd/sites-enabled/vhosts.conf file. The second field of the ProxyPass line is /sample. This means that when is requested, the web server will request from Tomcat. 

<VirtualHost *:80>
   DocumentRoot "/var/www/site1"
   <Proxy *>
     AddDefaultCharset Off
     Order deny,allow
     Allow from all
   ProxyPass /sample
   ProxyPassReverse /sample



Now, the Tomcat application can be produced by navigating to


Muliple JVMs on Tomcat

Another advantages of using a proxy pass is being able to route requests to a number of different Tomcat application servers. For example, let's say you have a single Tomcat server with three different JVMs, each listening on their own port.


A single web server can proxy requests to each JVM.

ProxyPass /app1
ProxyPass /app2
ProxyPass /app3


Multiple Tomcat

A proxy pass can also route requests to different Tomcat servers. For example, let's say you've three different Tomcat servers.


A single web server can proxy requests to each JVM.

ProxyPass /app1
ProxyPass /app2
ProxyPass /app3


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter da89b in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |