httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Rectanus" <brect...@gmail.com>
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 14:37:56 GMT
Hi,

On 6/27/06, Ruediger Pluem <rpluem@apache.org> wrote:
> 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
>

Doh, yes.  That is what I get for posting examples I have not tested ;)

>
> 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.

Yeah, I end up setting on every request.  Some further patching I
would like to do is add the ability for mod_proxy_balancer to actually
add/remove the cookie if you use something like
store-route=cookie:MYCOOKIE or similar.

I'll take a closer look and see if I can get the other env vars to be
a bit more useful.  I ended up adding them in more for completion than
for my needs and as you have seen they are not that useful/practical.

Thanks,
-B

Mime
View raw message