Forum Discussion
Steve_Knapp
Altostratus
Apr 14, 2014cookie persistence not working in iRule
I have the below Irule which sets cookie persistence on a specific HTTP request based on a field in the URI and then again on LB Select (didn't think it was needed but it's not working :-)) But when...
IheartF5_45022
Nacreous
Apr 15, 2014Why don't you assign a persist cookie insert profile to your vs so you don't need to use the iRule to touch it?
ltm persistence cookie my_ck {
cookie-name my_ck
defaults-from cookie
method insert
}
Also do you have the oneconnect profile enabled? Not having it could be affecting you as the LB decision only gets made once per TCP connection without oneconnect.
Try the iRule below as well as assign the profile to the virtual and enabling oneconnect and hopefully you'll be able to see it working - at least it should be easier to see what is happening.
when HTTP_REQUEST {
set debug 1
if {$debug} {
per request identifier
set prefix "\[[expr {int (rand() * 10000)}]\] "
log local0. "${prefix}URI = [HTTP::uri], cookies [HTTP::cookie names]"
}
if {[HTTP::uri] contains "sso-a" || (other stuff) } {
if {$debug} {log local0. "${prefix}Selecting member 10.110.3.11"}
pool ap-tcsso.infarmbureau.com_https_pool member 10.110.3.11
else if {[HTTP::uri] contains "sso-b" || (other stuff) } {
if {$debug} {log local0. "${prefix}Selecting member 10.110.3.12"}
pool ap-tcsso.infarmbureau.com_https_pool member 10.110.3.12
}
}
when LB_SELECTED {
if {$debug} {log local0. "${prefix}pool [LB::server pool] member [LB::server addr]:[LB::server port]"}
}
when HTTP_RESPONSE {
This is where you should see the cookies being returned to the client
if {$debug} {log local0. "${prefix}Set-Cookie [HTTP::header Set-Cookie]"}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects