Recently I had to install a Java application for a client using Tomcat6. The application needed to run from the root of their domain so I also installed apache2 and mod_proxy_ajp to set up a proxy to make this work. After a bit of massaging and googling to deal with Location Headers including the original path of the servlets rather than the proxy root. I've come up with this.
<VirtualHost *:80>
ServerName myclientssite.com
ErrorLog /var/log/apache2/ajp.error.log
CustomLog /var/log/apache2/ajp.log combined
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / ajp://localhost:8009/appname/
ProxyPassReverse / http://localhost:8080/appname/
ProxyPassReverseCookiePath /appname/ /
Header edit Location ^([^/]*//[^/]*)?/appname/(.*)$ $1/$2
</VirtualHost>
My question is wither this is the the best solution. It seems with out mod_headers and the Header edit line and headers will usually include the appname subdirectory.