views:

2506

answers:

1

I was working on debugging an issue today related to mixing mod_proxy and mod_rewrite together and I ended up having to use balancer://mycluster in the RewriteRule in order to stop receiving a 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 into the RewriteRule?

2) Is there a way to define all the parameters I defined in ProxyPass (stickysession=JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bytraffic nofailover=Off) in either the <Proxy> or RewriteRule? I'm concerned the requests that match the new RewriteRule won't load balance in the same fashion as those that go through ProxyPass (like /app1/something.do)?

Below are the relevant sections of the 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]
+1  A: 

Looks like I can use the ProxySet directive so the URL's that match the RewriteRule load balance in the same fashion.

<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>
Taylor Leese