Mixing RewriteRule and ProxyPass in Apache

I worked on debugging the problem today of mixing mod_proxy and mod_rewrite together, and I had to use balancer://mycluster in the RewriteRule to stop getting the 404 error from Apache. I have two questions:

1) Is there any other way to get the rewritten URL to go through the balancer without adding balancer://mycluster to the RewriteRule ?

2) Is there a way to define all the parameters defined in ProxyPass (stickysession = JSESSIONID | jsessionid scolonpathdelim = On lbmethod = bytraffic nofailover = Off) either in <Proxy> or RewriteRule ? I am concerned about requests that match the new RewriteRule , will not load the balance in the same way as those that go through ProxyPass (e.g. /app1/something.do )?

Below are the relevant sections of httpd.conf. I am using Apache 2.2.

 <Proxy balancer://mycluster> Order deny,allow Allow from all BalancerMember ajp://my.domain.com:8009 route=node1 BalancerMember ajp://my.domain.com:8009 route=node2 </Proxy> ProxyPass /app1 balancer://mycluster/app1 stickysession=JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bytraffic nofailover=Off ProxyPassReverse /app1 ajp://my.domain.com:8009/app1 

...

 RewriteRule ^/static/cms/image/(.*)\.(.*) balancer://mycluster/app1/$1.$2 [P,L] 
+4
source share
1 answer

It looks like I can use the ProxySet directive, so the URL corresponding to the load balance of the RewriteRule will be the same.

 <Proxy balancer://mycluster> Order deny,allow Allow from all BalancerMember ajp://my.domain.com:8009 route=node1 BalancerMember ajp://my.domain.com:8009 route=node2 ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bytraffic nofailover=Off </Proxy> 
+4
source

All Articles