Forum Discussion
Persistence iRule for Airwatch
I've been asked to write an iRule using CARP persistence and based on awcmsessionid. Found this on DevCentral and it was all I could find was wondering if anyone can tell if this works and/or have an iRule that does work. Thanks, Frank.
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
}
}
If no header found log local0. "The awcmsessionid HTTP header was not found" }
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"
}
}
}1 Reply
- Leonardo_Souza
Cirrocumulus
You need to create a persistence profile, and in the profile you link the profile to the irule you have created. Also, apply the profile to the virtual server.
Here are some solutions that can help clarify this to you:
https://support.f5.com/csp/article/K7392
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com