Persist On Last JSESSIONID in HTTP Parameter
Problem this snippet solves: This iRule was written with the goal to persist on only the last jsessionid that is present when multiple jsessionid HTTP Paremeters are present.. How to use this snipp...
Updated Jun 05, 2023
Version 2.0Jason_Adams
Ret. Employee
Joined February 28, 2013
stan_piron
Cumulonimbus
Apr 07, 2017more efficient code:
when CLIENT_ACCEPTED {
set debug 1
}
when HTTP_REQUEST {
set path [HTTP::path]
set logTuple "[IP::client_addr]:[TCP::client_port] - [IP::local_addr]:[TCP::local_port]"
if {[set last_jsessionid_pos [string last "jsessionid=" $path]] ne -1} {
if {[set semicolon_pos [string first ";" $path $last_jsessionid_pos]] ne -1} {
set session_id [string range $path [expr {$last_jsessionid_pos + 11}] [expr {$semicolon_pos -1}]]
} else {
set session_id [string range $path [expr {$last_jsessionid_pos + 11}] end]
}
Persist on the parsed session ID for X seconds
if {$debug}{log local0.debug "$logTuple :: Single JsessionID in: [HTTP::host][HTTP::uri]"}
persist uie $session_id 86400
}
}