« Return to Thread: Mixing Apache's mod_rewrite with mod_proxy

Mixing Apache's mod_rewrite with mod_proxy

by mraible :: Rate this Message:

Reply to Author | View in Thread

I want to configure Apache to front a Tomcat installation. I've done this in the past with mod_jk. I've got that setup and working. I also configured mod_proxy and got that working thanks to Graham King's excellent instructions[1]. I don't know which one is a better solution, but I have them both working, so I'm flexible.

Now onto my problem.  I'd like to use mod_write to rewrite some URLs for doing A/B Testing. In other words, we'll deploy entirely new WAR files when we have a test, then use the magic of Apache's mod_rewrite, mod_jk and possible the UrlRewriteFilter to keep the URLs somewhat consistent between version A and version B. Here's some questions I have for those folks who might've done this before:

   1. Is it possible to use Apache's mod_rewrite to map http://www.domain.com/?v=1 to http://www.domain.com/1 (this allows us to have two different applications/wars served up to the same domain).
   2. If #1 is possible, I'm assuming it's possible to add a RewriteRule for allowing the parameter to be anywhere in the query string?

I believe this is all possible. However, I am having difficulty getting mod_jk to allow mod_rewrite to be processed first. If I have the following in httpd.conf, it seems like htdocs/.htaccess gets bypassed.

JkMount /* loadbalancer

Likewise, if I use mod_proxy (config below) with RewriteRules in <Location />, the request is dispatched to Tomcat w/o processing the rules.

<Proxy balancer://tomcats>
   BalancerMember ajp://localhost:8009 route=tomcat1
   BalancerMember ajp://localhost:8010 route=tomcat2
</Proxy>

<Location />
    ProxyPass balancer://tomcats/ stickysession=JSESSIONID
</Location>
 
I've written this up in a blog post[2] as well, but figured this list is probably the best place to get this question answered.

Thanks!

Matt

[1] http://www.darkcoding.net/software/goodbye-mod_jk-hello-mod_proxy/
[2] http://raibledesigns.com/rd/entry/mixing_apache_http_server_mod

 « Return to Thread: Mixing Apache's mod_rewrite with mod_proxy