Forum Discussion
colincashin_171
Nimbostratus
Oct 25, 2012iRule to persist based on phpsessid
Hi
I am looking for guidance on setting up persistence based on phpsessid. We are load balancing across 2 Apache web servers and are using phpsessid for persistence between the servers. I wou...
colincashin_171
Nimbostratus
Oct 27, 2012Thanks nitass@ and hoolio@
The code snippet I included is indeed incorrect - the phpsessid is set in the set-cookie response from the server and not HTTP::path. I had a look at the Universal Profile section (http://support.f5.com/kb/en-us/solutions/public/7000/300/sol7392.html) and read through all options around HTTP::cookie and found that this greatly simplified approach works perfectly! I had completely over-engineered the solution for what I was trying to achieve.
What I now have in place (and works perfectly) is:
when HTTP_RESPONSE {
if { [HTTP::cookie exists "PHPSESSID"] } {
persist add uie [HTTP::cookie "PHPSESSID"]
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "PHPSESSID"] } {
persist uie [HTTP::cookie "PHPSESSID"]
}
}
Whats key is that in
persist add uie [HTTP::cookie "PHPSESSID"]
the HTTP::cookie name snippet: this gets the value of an existing cookie with the given name so it extracts the 26 character phpsessid from the set-cookie headers. Nice! Then we just persist based on this. Thanks for the assistance folks. I'm looking forward to making positive contributions to the community as I learn more about the platform 🙂
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
