Forum Discussion
uni
Altostratus
Sep 04, 2007Persistence using session cookies
I've read through a few of the articles on setting persistence based on the contents of a session cookie, and come up with the following:
when HTTP_REQUEST {
if { [HTTP::cookie exists "SESSIONID"] } {
if { persist lookup uie [HTTP::cookie "SESSIONID"] != "" } {
persist uie [HTTP::cookie "SESSIONID"] 600
}
}
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "SESSIONID"] } {
if { persist lookup uie [HTTP::cookie "SESSIONID"] == "" } {
persist add uie [HTTP::cookie "SESSIONID"] 600
}
}
}
The examples I've seen don't include tests for the prior existence of the persistence record as I have done above. Is it necessary to do so? i.e. if I attempt to add persistence that already exists, is it silently ignored, and if I attempt to use a persistence record that doesn't exist, is it silently ignored? If the "persist lookup" tests are not required, I expect it is more efficient to leave them out.
How do the timeouts work? I assume the "persist add" timeout starts a timer to clean up the persistence record. Does using the persistent record with "persist" extend the timer for the same period, and "persist" with a timeout extend the timer by the new amount?
What events can "persist add" be used in? It looks to me like it binds the persistence to the selected node, so can only be used once a server connection has been made, or maybe before in the LB_SELECTED event.
- hoolio
Cirrostratus
Hi Stephen, - uni
Altostratus
Thanks hoolio. It's a bit difficult for me to test as I don't have access to test servers, but I hadn't used the "persist show all" command, so that may help once I can implement something. - Leslie_South_55
Nimbostratus
When using session cookies, does the 'b persist all show all' actually show the persistent connections? When I issue this command, I get 'No persistent connections were found' and I am using cookie-insert as session cookies - hoolio
Cirrostratus
When using cookie insert persistence, no record is maintained on the BIG-IP, so 'b persist ...' will not show any records.
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