Forum Discussion
BASLI_amine_788
Nimbostratus
Aug 29, 2006How to use several pools and persistence profils with cookie insert method in an iRule
Hi,
We upgrade our Bigip from 4.2 to 9.2.3. In 4.2 the persistence was set on pools.So to keep our persistence in v9 we modified our irules to insert the right cookie depending on the pool we match. Exemple :
when HTTP_REQUEST {
if { [HTTP::host] matches_regex "^(www.)?cetelem.pt$"} {
redirect to "https://www.bancocetelem.pt"
}
elseif { [HTTP::host] matches_regex "^bancocetelem.pt$"} {
redirect to "https://www.bancocetelem.pt"
}
elseif { [HTTP::host] matches_regex "^www.bancocetelem.pt(:443)?$"} {
if { [HTTP::uri] starts_with "/PtDirect"} {
persist cookie insert Prf_cookie_Xnet-ptdirectnew
pool P_http_ptdirectnew
}
elseif { [HTTP::uri] starts_with "/PtHomeBK"} {
persist cookie insert Prf_cookie_Xnet_pthomebk
pool P_http_pthomebk
}
else {
persist cookie insert Prf_cookie_Xnet-ptdirect
pool P_http_ptdirect
}
}
}
In this example you can see the command we added to insert the cookie. In addition to bo able to do so we assigned a default persistance profil.
We encouter problems and the persistence doesn't work correctly. We lose connection and sometimes we are redirect to two differents members...
Can you please help us to configure correctly persistence using cookie insert method with iRules
Thank you
6 Replies
- unRuleY_95363Historic F5 AccountUh... I hate to correct, but no, the persist command doesn't reference the persist profile. Assuming he wants a cookie named "Prf_cookie_Xnet-ptdirectnew", then his persist cookie command syntax is correct.
What I was wondering was whether the hostname was matching at all and thus, that is why no cookie persistence is working.
Perhaps, you should add an else clause at the outer-most scope (the level of the host matching) and see if you are dropping through.
Other than that, this rule looks correct, so you may need to contact support for further help as to why the persistence is not working. - unRuleY_95363Historic F5 AccountI'm not sure which version you are running, but it really sounds like your are encountering a bug... It would probably be best to contact support.
- unRuleY_95363Historic F5 AccountNo problem Denny. We always appreciate all the help we can get!
- dennypayne
Employee
Resurrecting this thread....
I have now been able to test and see similar behavior to what abasli has reported...(did you get a response from support?)when HTTP_REQUEST { if { [HTTP::uri] contains "mema" } { persist cookie insert "Mema_Cookie" "0d 00:20:00" use pool GPC-test.p1 } elseif { [HTTP::uri] contains "gs1canada" } { persist cookie insert "GS1_Canada_Cookie" "0d 00:20:00" use pool GPC-test.p2 } else { persist cookie insert "Fallthrough_cookie" "0d 00:20:00" use pool GPC-test.p3 } }
I have been able to determine via HTTPWatch that the first cookie in this rule (Mema_Cookie) never gets set. The other 2 do get set correctly and persist correctly. But persistence breaks in the first pool on subsequent connections (whether I have OneConnect enabled or not).
I am going to try and reverse the order now and see if the behavior follows the first cookie in the list or not.
Any thoughts?
Denny - Ninjai_DI_67376
Nimbostratus
Is BIG-IP V9.2.3 required ?
I can not create such a rule in BIG-IP V9.1.2. - Ninjai_DI_67376
Nimbostratus
It can be created in BIGIP V9.2.3.
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