Forum Discussion
Kai_Wilke
Jan 27, 2016MVP
Hi Sahir,
the problem can be found in this code block...
if { [findstr [HTTP::uri] "jsessionid" 11 "!"] != ""} {
pool ets_80-pool member [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]
log local0. "jsessionID [findstr [HTTP::uri] "jsessionid" 11 "!"] sent to [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]"
} else {
pool ets_80-pool
log local0. "No jsession ID, local balancing the connection..."
}
If the client sends an [HTTP::uri] containing the string jsessionid, you'll will use a substring of it to find an matching [session lookup uie] record. But then you don't verify if the session query has deliverd any values before proceeding with the member node selection. I highly doubt this code has ever worked stable...?
An improved code would look like this...
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] } {
set trimID [lindex [split [HTTP::cookie "JSESSIONID"] "!" ] 0 ]
if { [session lookup uie $trimID] equals "" } {
session add uie $trimID [IP::server_addr] 1800
log local0. "added server entry [session lookup uie $trimID] for jsessionID $trimID "
} else {
log local0. "existing server entry [session lookup uie $trimID] for jsessionID $trimID"
}
}
}
when HTTP_REQUEST {
if { [active_members et-pool] == 0 } {
HTTP::redirect "http://[HTTP::header "X-Forwarded-Host"]/unavailable/etServices.html"
} else {
if { [HTTP::header exists "X-Forwarded-Host"] } {
HTTP::header replace "Host" [HTTP::header "X-Forwarded-Host"]
}
if { [HTTP::cookie exists "em-et"] } {
log local0. "Persisting by cookie em-et, contents are [HTTP::cookie "em-et"]"
} else {
set pool_member [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"]]
if { $pool_member ne "" } {
pool ets_80-pool member $pool_member
log local0. "jsessionID [findstr [HTTP::uri] "jsessionid" 11 "!"] sent to [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]"
} else {
pool ets_80-pool
log local0. "No jsession ID, local balancing the connection..."
}
}
}
}
Note: You may apply the improved code before updating the device...
Cheers, Kai