[PLUG] RewriteCond

Carlos Konstanski ckonstanski at pippiandcarlos.com
Wed Jul 6 06:34:00 UTC 2011


I'm having an issue with apache's mod_proxy_balancer. I need to set a cookie
in the form <something>.<routeid>. Using RewriteRule to do it. It's writing
the cookie fine, but it keeps REWRITING it upon every request
unconditionally with a new Set-Cookie. I think I need a RewriteCond to check
for the existence of the cookie first. Can someone help me understand how to
write the condition? Struggling with the docs.

Below is my entire balancer config.

Thanks,

Carlos

<VirtualHost *:80>
    ServerName dc.pippiandcarlos.com
    ServerAdmin postmaster at pippiandcarlos.com
    ProxyPass / balancer://dc.pippiandcarlos.com.cluster/
stickysession=BALANCEID
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

<Proxy balancer://dc.pippiandcarlos.com.cluster>
    BalancerMember http://dc1.pippiandcarlos.com/ route=dc1
    BalancerMember http://dc2.pippiandcarlos.com/ route=dc2
</Proxy>

<VirtualHost *:80>
    ServerName dc1.pippiandcarlos.com
    ServerAdmin postmaster at pippiandcarlos.com
    ProxyPass / http://dc1.pippiandcarlos.com:3001/
    ProxyPassReverse / http://dc1.pippiandcarlos.com:3001/
    RewriteEngine On
    RewriteRule .* - [CO=BALANCEID:balancer.dc1:.pippiandcarlos.com]
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

<VirtualHost *:80>
    ServerName dc2.pippiandcarlos.com
    ServerAdmin postmaster at pippiandcarlos.com
    ProxyPass / http://dc2.pippiandcarlos.com:3002/
    ProxyPassReverse / http://dc2.pippiandcarlos.com:3002/
    RewriteEngine On
    RewriteRule .* - [CO=BALANCEID:balancer.dc2:.pippiandcarlos.com]
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>



More information about the PLUG mailing list