Apache + Tomcat: Using mod_proxy instead of AJP

The settings you are looking for are:

<VirtualHost *:80>
  ServerName public.server.name

  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Note that we’re using localhost as the proxy target. We can do this since we enable ProxyPreserveHost. The documentation states that

It is mostly useful in special configurations like proxied mass name-based virtual hosting, where the original Host header needs to be evaluated by the backend server.

which sounds exactly like what you are doing.

Leave a Comment