Hi,
We have an application accessed through LB VIP. VIP has two pool members, both are active. We are using an iRule to do session persistence on ASP.net_sessionID. Details of the VIP are listed below. We have observed that if session is idle for more than 3 minutes, it gets disconnected /transferred to another server in the pool. Kindly suggest me if the ASP.net_sessionID persistence iRule causing any error or needs correction in the iRule.
virtual VS.LBVIP { snat automap pool Application_https destination :https ip protocol tcp rules { switch_connection ASP.NET_Sessionid } persist cookie_20Min profiles { httpRewrite {} SSL-Certificate { clientside } serverssl { serverside } tcp {} } }
pool Application_https { lb method member least conn monitor all https members { 1.1.1.1:https {} 1.1.1.2:https {} } }
pool Application_http lb method member least conn monitor all http members { 1.1.1.1:http {} 1.1.1.2:http{} } }
rule ASP.NET_Sessionid { when HTTP_REQUEST { if { [HTTP::cookie exists “ASP.NET_SessionId”] } { LB::detach } set SessionId [HTTP::cookie ASP.NET_SessionId] if { $SessionId ne “” } { persist uie $SessionId } }
when HTTP_RESPONSE {
log local0. “Response SessionId is: $SessionId from Set-Cookies: [HTTP::header values Set-Cookie]”
if {[HTTP::header exists "Set-Cookie"]} {
foreach cookievalue [HTTP::header values "Set-Cookie"] {
if { $cookievalue contains "ASP.NET_SessionId" } {
set SessionId [findstr $cookievalue "ASP.NET_SessionId" 18 ";"]
if { $SessionId ne "" } { persist add uie $SessionId }
log local0. "Persist record [persist lookup uie $SessionId]"
}
}
}
} }
rule switch_connection { when HTTP_REQUEST { switch -glob [HTTP::uri] { “/AAA" { SSL::disable serverside pool Application_http } "/BBB” { pool Application_https }
}
} }
profile persist cookie_20Min { defaults from cookie mode cookie cookie mode insert cookie expiration 0:20:00 }
Thanks, Rajendra