Forum Discussion
Julian_Grunnell
Nimbostratus
Jun 13, 2007Cookie Rewrite & ASPSESSIONID Mk. II
Hi - well looks like my previous post got foobar'd somehow. Anyway thanks to willms & hoolio for their valuable input!!
I amended willms iRule slightly to:
when HTTP_RESPONSE {
set ASPID [findstr [HTTP::cookie names] "ASPSESSIONID" 0 20]
set debug "1"
if { $ASPID ne "" } {
if $debug {log local0. "ASPSESSIONID FOUND $ASPID"}
}
else {
if $debug {log local0. "ASPSESSIONID NOT FOUND"}
}
}
And the ltm log showed:
Jun 13 09:37:02 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID NOT FOUND
Jun 13 09:37:02 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID NOT FOUND
Jun 13 09:37:03 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID FOUND ASPSESSIONIDCCDATSAB
Jun 13 09:37:03 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID FOUND ASPSESSIONIDCCDQCBQR
Jun 13 09:37:03 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID FOUND ASPSESSIONIDQQSCDCQQ
Jun 13 09:37:03 tmm tmm[952]: Rule ASPTEST : ASPSESSIONID NOT FOUND
So we can capture the ASPSESSIONID info.
When we originally tried cookie insert the customer complained of some of his customers being logged out or told they were not logged in. A sympton of being re-load balanced and presenting an ASPSESSIONID that the server knew nothing about? Unfortunately we didn't capture any tcpdump or header info at this stage so are going of memory!! But I agree with you hoolio the load balancing should work irrespective of what cookie the node might set.
The whole problem with failure is that I've not seen any, the site is VERY busy and tcpdumps are 100mb+ in less than a minute. And we rely on the customer getting complaints from his clients accessing the site. It's all very messy to work out I'm afraid.
Thanks again - Julian.
8 Replies
Sort By
- JRahm
Admin
I also saw occassional issues with cookie persistence, so I use the session table to build the backend pool member reference from the sessionID. Maybe not the most efficient way, but I don't have any issues with it.when HTTP_RESPONSE { if { [HTTP::cookie exists "ASPSESSIONID"] } { if { [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]] equals "" } { session add uie $sessionID [IP::server_addr] 1800 log local0. "added server entry [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]]\ for aspsessionID [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20] " } else { log local0. "existing server entry [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]]\ for aspsessionID [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]" } } } when HTTP_REQUEST { if { [HTTP::cookie exists "ASPSESSIONID"] } { if { !([session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]] equals "") } { pool [LB::server pool] member [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]] log local0. "aspsessionID [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20] \sent to [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]]" } else { pool [LB::server pool] log local0. "No aspsession ID, load balancing the connection..." } } }
- hoolio
Cirrostratus
I noticed that SOL5714 (Click here) describes some possible reasons for cookie persist failures. I wonder if any of these issues may have affected your testing with cookie insert persistence... - Deb_Allen_18Historic F5 Accountwhat am I missing here?
Wouldn't this look for a session table entry keyed on the 20 char following the string "ASPSESSIONID" in the list of cookie names... which would be the name of another cookie (or cookies), if any were listed after ASPSESSIONID, rather than the expected ASPSESSIONID cookie value itself...?if { [session lookup uie [findstr [HTTP::cookie names] "ASPSESSIONID" 12 20]] equals "" } {
when HTTP_RESPONSE { set sessionID "" if { [HTTP::cookie exists "ASPSESSIONID"] } { set sessionID [HTTP::cookie ASPSESSIONID] set persistTo [session lookup uie $sessionID] if { $persistTo equals "" } { session add uie $sessionID [IP::server_addr] 1800 log local0. "added server entry $persistTo for aspsessionID $sessionID" } else { log local0. "existing server entry $persistTo for aspsessionID $sessionID" } } } when HTTP_REQUEST { set sessionID "" if { [HTTP::cookie exists "ASPSESSIONID"] } { set sessionID [HTTP::cookie ASPSESSIONID] set persistTo [session lookup uie $sessionID] if { $persistTo equals "" } { pool [LB::server pool] log local0. "No aspsession ID, load balancing the connection..." } else { pool [LB::server pool] member $persistTo log local0. "aspsessionID $sessionID sent to $persistTo" } } }
- hoolio
Cirrostratus
Some background info on the aspsessionid cookie: - Deb_Allen_18Historic F5 AccountHow Bizarre. Thanks for cluing me in.
- Deb_Allen_18Historic F5 AccountSo does this command really return True for a cookie named ASPSESSIONIDabcdefghikjklmnopqrs?
HTTP::cookie exists ASPSESSIONID
- hoolio
Cirrostratus
Nope. You could look for it by looping through the cookie names looking for starts_with aspsessionid. - Deb_Allen_18Historic F5 AccountOK, good to know.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects