|
/
Zope
/
Apsis
/
Pound Mailing List
/
Archive
/
2007
/
2007-07
/
Using a regular expression for session cookie name
[
pound installation - debian etch / "Andreas ... ]
[
Re: pound enchangements / Gergely CZUCZY ... ]
Using a regular expression for session cookie name
Russell Odom <listsignups(at)zolv.com> |
2007-07-20 18:17:16 |
[ SNIP ]
|
Hi all,
I have a web cluster (2 servers so far) hosting a mixture of ASP and
ASP.NET applications, and I need session stickiness based on the cookie
for each of these two languages. ASP uses a cookie with the name
"ASPSESSIONID{some random letters}", ASP.NET uses a cookie named
"ASP.NET_SessionId". Both cookies, of course, have some random
identifier as their value.
No problem, I thought, I can just use a regexp to match the cookie name:
> Session
> Type COOKIE
> TTL 1200
> ID "(ASP.NET_SessionId|ASPSESSIONID[A-Z]*)"
> End
To my delight this appears to work and saves me having to define a
separate service for each type of application; using poundctl I see this:
> 0. Session ASPSESSIONIDCSTCARDS -> 0
> 1. Session ASPSESSIONIDCQQBDRDT -> 0
> 2. Session ASPSESSIONIDCCCCSSBD -> 1
> 3. Session ASPSESSIONIDCADBSSBC -> 1
> 4. Session ASPSESSIONIDCABCSTBD -> 1
> 5. Session ASPSESSIONIDASTCDQDS -> 0
> 6. Session ASPSESSIONIDAADASTAC -> 1
> 7. Session ASP.NET_SessionId -> 0
On first glance, not knowing what to expect, it looks OK; pound is
giving me the names of the cookies. However, I notice that whenever I
look, there is only ever a single "ASP.NET_SessionId" session, which
seems a little strange.
Later, I added another service that only uses ASP.NET sessions:
> Session
> Type COOKIE
> TTL 1200
> ID "ASP.NET_SessionId"
> End
For that service, poundctl is currently telling me:
> 0. Session nba3hjzugmuqu5fymsozanbl -> 0
> 1. Session 0pyn3k550dlgdruhnr55xbrr -> 0
So, it looks like, when I use a regexp to match the cookie name, pound
starts using the *name* rather than the *value* of the cookie for the
session key. This results in very unbalanced load balancing, since all
users with the same named cookie (all the ASP.NET users, in my case)
will always be assigned to a single back-end.
Is this a bug, or am I missing something here?
I'm using Dag Wieers' Pound RPM on CentOS 5:
> [root(at)small ~]# uname -a
> Linux small.zolv.net 2.6.18-8.1.4.el5 #1 SMP Thu May 17 03:26:03 EDT 2007
i686 i686 i386 GNU/Linux
> [root(at)small ~]# rpm -q pound
> pound-2.3-1.el5.rf
Thanks for any insight anyone can provide!
Russ
--
Russell Odom
Technical Director, Zolv
"I didn't do it, nobody saw me do it, can't prove anything."
|
|
|
Re: [Pound Mailing List] Using a regular expression for session cookie name
Robert Segall <roseg(at)apsis.ch> |
2007-07-21 10:35:49 |
[ SNIP ]
|
On Fri, 2007-07-20 at 17:17 +0100, Russell Odom wrote:
> Hi all,
>
> I have a web cluster (2 servers so far) hosting a mixture of ASP and
> ASP.NET applications, and I need session stickiness based on the cookie
> for each of these two languages. ASP uses a cookie with the name
> "ASPSESSIONID{some random letters}", ASP.NET uses a cookie named
> "ASP.NET_SessionId". Both cookies, of course, have some random
> identifier as their value.
>
> No problem, I thought, I can just use a regexp to match the cookie name:
> > Session
> > Type COOKIE
> > TTL 1200
> > ID "(ASP.NET_SessionId|ASPSESSIONID[A-Z]*)"
> > End
Try instead
ID "ASP\.NET_SessionId|ASPSESSIONID[A-Z]*"
that is, your expression without parentheses.
> To my delight this appears to work and saves me having to define a
> separate service for each type of application; using poundctl I see this:
> > 0. Session ASPSESSIONIDCSTCARDS -> 0
> > 1. Session ASPSESSIONIDCQQBDRDT -> 0
> > 2. Session ASPSESSIONIDCCCCSSBD -> 1
> > 3. Session ASPSESSIONIDCADBSSBC -> 1
> > 4. Session ASPSESSIONIDCABCSTBD -> 1
> > 5. Session ASPSESSIONIDASTCDQDS -> 0
> > 6. Session ASPSESSIONIDAADASTAC -> 1
> > 7. Session ASP.NET_SessionId -> 0
>
> On first glance, not knowing what to expect, it looks OK; pound is
> giving me the names of the cookies. However, I notice that whenever I
> look, there is only ever a single "ASP.NET_SessionId" session, which
> seems a little strange.
>
> Later, I added another service that only uses ASP.NET sessions:
> > Session
> > Type COOKIE
> > TTL 1200
> > ID "ASP.NET_SessionId"
> > End
>
> For that service, poundctl is currently telling me:
> > 0. Session nba3hjzugmuqu5fymsozanbl -> 0
> > 1. Session 0pyn3k550dlgdruhnr55xbrr -> 0
>
> So, it looks like, when I use a regexp to match the cookie name, pound
> starts using the *name* rather than the *value* of the cookie for the
> session key. This results in very unbalanced load balancing, since all
> users with the same named cookie (all the ASP.NET users, in my case)
> will always be assigned to a single back-end.
No. You can use a regular expression for the cookie name and it will
work fine. Do NOT uses parentheses.
> Is this a bug, or am I missing something here?
Parentheses mark a sub-pattern that can be extracted. Pound expects the
first such pattern to be the cookie value. By putting parentheses in
your definition you are causing Pound to extract the cookie name rather
than value.
--
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904
|
|
|
Re: [Pound Mailing List] Using a regular expression for session cookie name
Russell Odom <listsignups(at)zolv.com> |
2007-07-23 10:46:20 |
[ SNIP ]
|
Robert Segall wrote:
>
> Try instead
>
> ID "ASP\.NET_SessionId|ASPSESSIONID[A-Z]*"
>
> that is, your expression without parentheses.
Great, that seems to have done the trick. Thanks!
> Parentheses mark a sub-pattern that can be extracted. Pound expects the
> first such pattern to be the cookie value. By putting parentheses in
> your definition you are causing Pound to extract the cookie name rather
> than value.
It might be an idea to note to that effect in the man page, as it's not
immediately obvious.
Thanks once again,
Russ
--
Russell Odom
Technical Director, Zolv
A conclusion is the place where you got tired of thinking.
|
|
|
|