Forum Discussion
quickref_74249
Nimbostratus
Nov 23, 2011ASP stickiness with multiple cookies
Hi, i know that there's is already a codeshare example for this kind of stickiness but i need an extension and i don't know how to set up the rule.
I set up the following IRule:
when HTTP_R...
hoolio
Cirrostratus
Nov 23, 2011HTTP::cookie ASP.NET_SessionId will return the value for the (last) ASP.NET_SessionId cookie, regardless of how many other cookies are set in the response. So you shouldn't need to parse the Set-Cookie headers anyhow.
Your first iRule should be working as is. If it's not you could add more debug logging to it:
when HTTP_REQUEST {
set SessionId [HTTP::cookie ASP.NET_SessionId]
log local0. "[IP::client_addr]:[TCP::client_port]: Request SessionId is: $SessionId"
if { $SessionId != "" } { persist uie $SessionId 3600 }
}
when LB_SELECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Selected [LB::server]"
}
when LB_FAILED {
log local0. "[IP::client_addr]:[TCP::client_port]: Failed [LB::server]"
}
when SERVER_CONNECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Connected [IP::server_addr]:[TCP::server_port]"
}
when HTTP_RESPONSE {
set SessionId [findstr [HTTP::cookie "ASP.NET_SessionId"] 18 24]
log local0. "[IP::client_addr]:[TCP::client_port]: "Response SessionId is: $SessionId from Set-Cookies: [HTTP::header values Set-Cookie]"
if { $SessionId != "" }{
persist add uie $SessionId 3600
log local0. "[IP::client_addr]:[TCP::client_port]: Persist record [persist lookup uie $SessionId]"
}
}Also, you should add a OneConnect profile to the virtual server to ensure each request is evaluated for persistence. If you're using SNAT you can use the default OneConnect profile with a /0 source mask. Else if you're not using serverside source address translation, create a custom OneConnect profile with the source mask set to /32. See this article for details:
http://devcentral.f5.com/wiki/AdvDesignConfig.ONECONNECT.ashx
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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