You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ryan Johnson <rj...@espgroup.net> on 2007/03/21 17:20:26 UTC

[users@httpd] Sticky sessions with proxy_balancer

Hey all,

I am trying to get sticky sessions to work with mod_proxy_balancer, with 
no luck.
I have set stickysession=COOKIENAME.

Have not found any good doc on this? Anyone get this working?

Thanks in advance,
Ryan


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Sticky sessions with proxy_balancer

Posted by Ryan Murray <ry...@elementn.com>.
Ryan-

The logic of the balancer requires a "route" to be defined in the balancer.
Basically the balancer code gets your sessionid via the "stickysession"
param then uses this value to find the right worker.  If the sessionid
contains a "." then only the part after the "." is considered as the route.

In your case you have no "." in the cookie values so you should have a
config like below.  Note the "app1" and "app2" routes in the respective
members of the balancer.

<Location />
    ProxyPass balancer://cluster/ stickysession=BIG
    Allow from all
</Location>

<Proxy balancer://cluster>
    BalancerMember http://vhost1 route=app1
    BalancerMember http://vhost2 route=app2
</Proxy>

Hope that helps,
Ryan

-----Original Message-----
From: Ryan Johnson [mailto:rjohnson@espgroup.net] 
Sent: Wednesday, March 21, 2007 11:11 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Sticky sessions with proxy_balancer

Ryan (The Greater),

No luck.
I have two apache virtual hosts behind the load balancer, each setting a
cookie called BIG, one to a value of app1 and the other to a value of app2.
In the debug output I see the balancer module recognizing these values, but
it continues to split the requests across both servers rather than staying
on one server. I know with a F5 BIGIP you call the cookies by a certain name
and set the values to an encoding of their ip and port.

Any ideas?

Thanks,
Ryan (The True Lesser)

Ryan Murray wrote:
> Ryan-
>
> Yes it works for sure in httpd-2.2.4 but pay attention that this 
> parameter is case sensitive.  So if your cookie is "JSESSIONID" it 
> must be written in upper case like this in the config file.  Note for 
> Java the cookie is "JESESSIONID" whereas the path parameter is 
> ";jsessionid" (lc) and mod_proxy balancer doesn't handle this as it 
> checks for the same case sensitive name for both the path and the cookie.
>
> Turn your error log level to debug (LogLevel DEBUG in httpd.conf)and 
> optionally do a tail -f <logfile> | grep "BALANCER" and you'll see 
> when mod_proxy_balancer thinks it is getting a hit for the session param.
>
> If you are working with Java and need the dual case version I have a 
> patched the source for httpd-2.2.4 to allow specifying a 
> stickysessionpath param in the balancer config so it finds both Cookie and
path managed sessions.
>
> Cheers,
> Ryan (the lesser)
>
> -----Original Message-----
> From: Ryan Johnson [mailto:rjohnson@espgroup.net]
> Sent: Wednesday, March 21, 2007 6:20 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] Sticky sessions with proxy_balancer
>
> Hey all,
>
> I am trying to get sticky sessions to work with mod_proxy_balancer, 
> with no luck.
> I have set stickysession=COOKIENAME.
>
> Have not found any good doc on this? Anyone get this working?
>
> Thanks in advance,
> Ryan
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>   



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Sticky sessions with proxy_balancer

Posted by Ryan Johnson <rj...@espgroup.net>.
Ryan (The Greater),

No luck.
I have two apache virtual hosts behind the load balancer, each setting a 
cookie called BIG, one to a value of app1 and the other to a value of 
app2. In the debug output I see the balancer module recognizing these 
values, but it continues to split the requests across both servers 
rather than staying on one server. I know with a F5 BIGIP you call the 
cookies by a certain name and set the values to an encoding of their ip 
and port.

Any ideas?

Thanks,
Ryan (The True Lesser)

Ryan Murray wrote:
> Ryan-
>
> Yes it works for sure in httpd-2.2.4 but pay attention that this parameter
> is case sensitive.  So if your cookie is "JSESSIONID" it must be written in
> upper case like this in the config file.  Note for Java the cookie is
> "JESESSIONID" whereas the path parameter is ";jsessionid" (lc) and mod_proxy
> balancer doesn't handle this as it checks for the same case sensitive name
> for both the path and the cookie.
>
> Turn your error log level to debug (LogLevel DEBUG in httpd.conf)and
> optionally do a tail -f <logfile> | grep "BALANCER" and you'll see when
> mod_proxy_balancer thinks it is getting a hit for the session param.
>
> If you are working with Java and need the dual case version I have a patched
> the source for httpd-2.2.4 to allow specifying a stickysessionpath param in
> the balancer config so it finds both Cookie and path managed sessions.
>
> Cheers,
> Ryan (the lesser)
>
> -----Original Message-----
> From: Ryan Johnson [mailto:rjohnson@espgroup.net] 
> Sent: Wednesday, March 21, 2007 6:20 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] Sticky sessions with proxy_balancer
>
> Hey all,
>
> I am trying to get sticky sessions to work with mod_proxy_balancer, with no
> luck.
> I have set stickysession=COOKIENAME.
>
> Have not found any good doc on this? Anyone get this working?
>
> Thanks in advance,
> Ryan
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>   



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Sticky sessions with proxy_balancer

Posted by Ryan Murray <ry...@elementn.com>.
Ryan-

Yes it works for sure in httpd-2.2.4 but pay attention that this parameter
is case sensitive.  So if your cookie is "JSESSIONID" it must be written in
upper case like this in the config file.  Note for Java the cookie is
"JESESSIONID" whereas the path parameter is ";jsessionid" (lc) and mod_proxy
balancer doesn't handle this as it checks for the same case sensitive name
for both the path and the cookie.

Turn your error log level to debug (LogLevel DEBUG in httpd.conf)and
optionally do a tail -f <logfile> | grep "BALANCER" and you'll see when
mod_proxy_balancer thinks it is getting a hit for the session param.

If you are working with Java and need the dual case version I have a patched
the source for httpd-2.2.4 to allow specifying a stickysessionpath param in
the balancer config so it finds both Cookie and path managed sessions.

Cheers,
Ryan (the lesser)

-----Original Message-----
From: Ryan Johnson [mailto:rjohnson@espgroup.net] 
Sent: Wednesday, March 21, 2007 6:20 PM
To: users@httpd.apache.org
Subject: [users@httpd] Sticky sessions with proxy_balancer

Hey all,

I am trying to get sticky sessions to work with mod_proxy_balancer, with no
luck.
I have set stickysession=COOKIENAME.

Have not found any good doc on this? Anyone get this working?

Thanks in advance,
Ryan


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org