Forum Discussion
cjunior
Apr 12, 2016Nacreous
Hello dude,
I didn't understand if you want to check if there is any order of procedence or if you are looking for a dynamic way to read cookies by name. Following my example, it's checking if any of the requested cookies has previous persistence considering that the request may have more than one session cookie. Regards.when HTTP_REQUEST {
set uie_key ""
foreach cookie [HTTP::cookie names] {
if { $cookie starts_with "JSESSIONID" } {
set uie_key [string tolower [HTTP::cookie value $cookie]]
if { [persist lookup uie $uie_key] ne "" } {
contains persist-record
break
}
}
}
if { $uie_key eq "" and [string match -nocase *jsessionid* [HTTP::path]] } {
set uie_key [getfield [findstr [string tolower [HTTP::path]] "jsessionid" 10] "=" 2]
}
if { $uie_key ne "" } {
persist uie $uie_key 300
}
unset uie_key
}
when HTTP_RESPONSE {
foreach cookie [HTTP::cookie names] {
if { $cookie starts_with "JSESSIONID" } {
persist add uie [string tolower [HTTP::cookie value $cookie]] 300
break
}
}
}