Apache 2.2 + Tomcat 6 + mod_proxy
After stumbling around with lousy documentation and zero examples, I finally found at least one site which hinted at how to do this, and led me to this solution.
Your virtual host file should look something like this:
<VirtualHost *:80>
ServerName j.digitalcove.ca
DocumentRoot /usr/local/tomcat
ProxyRequests On
ProxyPreserveHost On
<Location />
ProxyPass http://127.0.0.1:8081/
ProxyPassReverse http://127.0.0.1:8081/
</Location>
<Proxy http://127.0.0.1:8081/>
AllowOverride None
Order allow,deny
Allow from All
</Proxy>
</VirtualHost>
A few things to note here - we need to enclose the Proxy instructions in a <Location> marker, and we have to include a <Proxy> section. None of the documentation (either Apache webserver's or Tomcat's) mentions this. Without the <Proxy> section, you will always get an HTTP 403 "Forbidden" error message.
Unlike the site mentioned previously, I also opted for adding a new connection at port 8081 so that I can use the proper Tomcat attributes "proxyName" and "proxyPort", as can be seen in this connector definition (which I placed directly in my <Service> section:
<Connector port="8081" protocol="HTTP/1.1" proxyName="j.digitalcove.ca" proxyPort="80"/>
Enjoy!
Comments
Finally! Found a solution to get rid of the troubles with trailing slashes! Thanks dude!
Add comment
Visit my Friends and Family
If you've enjoyed my site, please take a moment to visit my friends and family, many of whom have some interesting insights, and entertaining thoughts and ideas.
- Crause Family - the family website
- Peter Crause - my father
- Justin Crause - my brother
- Cencina Photomagic - great photographer