How to configure HTTPD to proxy pass a Tomcat application

Home > Search > How-to
  by

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 www.example.com:8080/sample direct from Tomcat, and then Tomcat sends the application to the client.

 

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

 

In the $CATALINA_HOME/conf/server.xml file, ensure Tomcat is configured to use AJP on port 8009.

<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.

<VirtualHost *:80>
   ServerName www.example.com
   DocumentRoot "/var/www/site1"
 
   <Proxy *>
     AddDefaultCharset Off
     Order deny,allow
     Allow from all
   </Proxy>
 
   ProxyPass / http://www.example.com:8080/
   ProxyPassReverse / http://www.example.com:8080/

</VirtualHost>

 

Now, the Tomcat application can be produced by navigating to www.example.com/sample.



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 in the box below so that we can be sure you are a human.




Comments