Forum Discussion
What_Lies_Bene1
Oct 02, 2014Cirrostratus
OK, this shouldn't be too hard. Any specific reason you want to use CARP? Here's a first attempt;
when HTTP_RESPONSE {
Check the awcmsessionid header exists
if { [HTTP::header exists "awcmsessionid"] } {
If it does, check it has a usable value
if { [HTTP::header value "awcmsessionid"] != "" } {
If it does, use it to create a persistence record
persist add uie [HTTP::header value "awcmsessionid"] 1800
}
else {
log local0. "The awcmsessionid HTTP header was found but is null"
No luck then, will need to rely on request query string if we can
}
else {
log local0. "The awcmsessionid HTTP header was not found"
No luck then, will need to rely on request query string
}
}
}
when HTTP_REQUEST {
Check the awcmsessionid header exists
if { [HTTP::header exists "awcmsessionid"] } {
If it does, check it has a usable value
if { [HTTP::header value "awcmsessionid"] != "" } {
If it does, use it to do a persistence lookup
If you need to select a pool, do so here, before we persist
persist uie [HTTP::header value "awcmsessionid"] 1800
exit here to ensure we don't do two persistence lookups
return
}
else {
log local0. "The awcmsessionid HTTP header was found but is null"
No luck then, will need to rely on request query string
}
}
No header so lets use the HTTP query instead, if we can
Check the right string exists
if { [string tolower [HTTP::query ]] contains "awcmsessionid" } {
The required query string is there, let's get it's value
We'll find awcmsessionid, move one to the right (the =)
and store data to the end of the query in our variable
set querystring [findstr [HTTP::query] "awcmsessionid" "1"]
Lets check its not null
if { $querystring != "" } {
persist uie $querystring 1800
}
else {
log local0. "No header or relevant query string found - can't persist"
}
}
}