Forum Discussion
Peter_Chase_150
Sep 13, 2005Nimbostratus
Expire Persistence Cookie
Because of application design we have active cookie persistence set up to make sure each user stays on a particular server in a pool. There are particular times in the application that users would be...
Martin_Machacek
Sep 14, 2005Historic F5 Account
Pete,
the only way (I can think of) how to "expire" a persistence cookie via iRule is to send the client to a different (secondary) pool (based on URI and/or cookie). The secondary pool should have the same members (nodes) as the primary pool but should use different cookie for persistence. The rule needs to detect presense of the secondary cookie and send all subsequent requests to the secondary pool. The client will keep returning the primary cookie till it expires but it will be ignored at the secondary pool. Example:
pool primary {
persist cookie
cookie_mode insert
cookie_name primaryCookie
cookie_expiration 00:30:00
member 10.1.21.2:http
member 10.1.21.3:http
member 10.1.21.4:http
}
pool secondary {
persist cookie
cookie_mode insert
cookie_name secondaryCookie
cookie_expiration 00:30:00
member 10.1.21.2:http
member 10.1.21.3:http
member 10.1.21.4:http
}
rule cookie_selector {
if((http_uri contains "/good_time_to_lb_again/" and exists http_cookie("primaryCookie")) or exists http_cookie("secondaryCookie")) {
use pool secondary
} else {
use pool primary
}
}
The solution does not scale too far, because it allows only one "re-loadbalancing" event. The best way how to implement application triggered re-loadbalancing is using cookie persistence in passive or rewite mode and control the cookie from within your application. That way you can expire the cookie at will.
BTW, You should always configure expiration time for your persistence cookies unless you want your clients to persist infinitely. In general the expiration time should be equal to or shorter than a session inactivity timeout in your application (if it has any).
You don't need to do anything special in order to deal with removed and/or disabled nodes. BIG-IP automatically falls-back to loadbalancing if the node recorded in persistence cookie received from client no longer exists or is down.
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