httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r417238 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_proxy_balancer.xml modules/proxy/mod_proxy_balancer.c
Date Tue, 27 Jun 2006 10:06:32 GMT
Brian Rectanus wrote:
> On 6/26/06, Mladen Turk <mturk@apache.org> wrote:

>>
>> Thinking of it more deeply, the only valuable env var would
>> be BALANCER_SESSION_ROUTE.
>> All other parms are meaningless for the client unless
>> you wish to create a loadbalancer as a cgi script.
>>
>> Regards,
>> Mladen.
>>
>>
> 
> I had two intentions with BALANCER_SESSION_ROUTE:
> 
> 1) Provide a way for client to detect a server switch and possibly
> cleanup (maybe remove the session cookie so next attempt would not
> fail if server was gone and nofailover=On).  Cleanup will be important
> since these are session cookies and the server app has no way to
> cleanup (it is down) and the user must restart his/her browser (remove
> session cookie) to rebalance.
> 
> RewriteRule "%{ENV:BALANCER_SESSION_ROUTE}
> !="%{BALANCER_WORKER_ROUTE}" [E=REBALANCED:1]
> Header add Set-Cookie "MYCOOKIE=;
> path=/; expires=Monday, 01-Jan-1990 08:00:00 GMT
> 
> " env=REBALANCED


As far as I can see this also does not work, because these environment
variables are set during the handler phase and thus are not available
for rewrite rules.

But I guess the patch can be used to setup the appropriate session
routing inside of httpd if your backend does not support adding a route
to the session cookie (this has been requested frequently):

SetEnvIf ^Cookie$  MYCOOKIE HAVE_ROUTE
Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e;
path=/;" env=!HAVE_ROUTE
ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE
nofailover=On


Of course this approach does not notice the client once you have
switched your backend worker. Using


Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e;
path=/;"
ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE
nofailover=On

fixes this, but sets the cookie on every response which may not be what
you want.

Regards

RĂ¼diger

Mime
View raw message