Excluding directories in AJP ProxyPass

Configuring Apache with Tomcat

You might have ProxyPass configured to pass all requests to Tomcat. However its better to serve some content directly from Apache for speed – images for instance. If you arrange your site into a well planned folder structure you can exclude certain folders in proxy_ajp.conf.

You might have this:

ProxyPass / ajp://localhost:8080/

Just add this line BEFORE the catch-all above:

ProxyPass /images !
ProxyPass / ajp://localhost:8080/

The file is parsed in order, so the exclude must come first.

Watch out for more Tomcat tips and tricks in the future.  Information on our market leading Tomcat hosting can be found here

Published by


2020Media is a leading UK web host offering Linux and Windows website hosting. The company specialises in WordPress, Joomla and Drupal support.