/ 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 [ FULL ]
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:[...]

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:[...]

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:[...]

For that service, poundctl is currently telling me:[...]

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:[...]

Thanks for any insight anyone can provide!

Russ
[...]

Re: [Pound Mailing List] Using a regular expression for session cookie name
Robert Segall <roseg(at)apsis.ch>
2007-07-21 10:35:49 [ FULL ]
On Fri, 2007-07-20 at 17:17 +0100, Russell Odom wrote:[...]

Try instead

	ID	"ASP\.NET_SessionId|ASPSESSIONID[A-Z]*"

that is, your expression without parentheses.
[...]

No. You can use a regular expression for the cookie name and it will
work fine. Do NOT uses parentheses.
[...]

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

Re: [Pound Mailing List] Using a regular expression for session cookie name
Russell Odom <listsignups(at)zolv.com>
2007-07-23 10:46:20 [ FULL ]
Robert Segall wrote:[...]

Great, that seems to have done the trick. Thanks!
[...]

It might be an idea to note to that effect in the man page, as it's not
immediately obvious.

Thanks once again,

Russ
[...]

MailBoxer