First off, is it possible to add persistence to a pool via a Virtual Server iRule?
Also, if so, how would this be accomplished? I’m still new with iRules.
Essentially what I am after is: in the old version 4 BigIPs, you could enable persistence on the pools, but now you can only via the VS (virtual server). We have a VS with an iRule which determines which pool to use, and 1 of the pools we would like to have persistence enabled. Can this be done by editing/enabling persistence for that pool in the iRule?
The type of persistence I would like to add is “Active HTTP Cookie Method: insert”.
If you could point me in the right direction that would be very appreciated.
You’re correct in that in 4.x you could specify persistence per pool. Now in 9.x/10.x, persistence is set per VIP. You can use an iRule to make more granular persistence decisions.
when HTTP_REQUEST {
Check requested path
if {[HTTP::path] ends_with ".wav"}{
Use cookie persistence (session - no timeout) for this request
persist cookie insert my_persist_cookie 0
} else {
Use no persistence for this request
persist none
}
}
You’ll need to add a blank cookie insert persistence profile to the VIP. The iRule then enables and configures or disables the cookie persistence profile according to your required logic.