Forum Discussion
hooleylist
Nov 23, 2011Cirrostratus
HTTP::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