Main Content

Simplest ever proxy configuration?

Archive - Originally posted on "The Horse's Mouth" - 2011-06-28 13:03:20 - Graham Ellis

Scenario ... Apache Http Server fronting an Apache Tomcat server. Http Server has mod_rewrite and mod_proxy installed.

When we first did httpd and Tomcat courses, getting the two to talk to each other involved builds of extra modules and all sorts of configuration. I did my "simplest ever" this morning - it came down to these two directives in a .htaccess file:

RewriteEngine On
RewriteRule (.*) http://192.168.200.102:2080/latmjdemo/ [P,L]


Works a treat to forward a whole webapp. Our Deploying Apache httpd and Tomcat course has moved forward considerably over the years- we not have plenty more time for load balancing, cluseting, monitoring, sticky sessions and the like ... runs five of six times a year as a public course, with more delegates being taught on our other private courses than on the public ones.




So as not to overlook the more complex stuff ;-)

<Proxy balancer://crawl>
BalancerMember ajp://192.168.200.102:2009/latmjdemo route=jvm102
BalancerMember ajp://192.168.200.103:2009/latmjdemo route=jvm103
BalancerMember ajp://192.168.200.104:2009/latmjdemo route=jvm104
</Proxy>
ProxyPass /latmjdemo balancer://crawl stickysession=JSESSIONID|jsessionid
ProxyPassReverse /latmjdemo balancer://crawl
ProxyPassReverseCookieDomain .* 192.168.200.102
ProxyPassReverseCookiePath /latmjdemo /latmjdemo


That's a load balanced, sticky session working example