Forum Discussion
iRule 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 would like to setup an iRule to track the phpsessid in HTTP request/responses and persist to the correct server.
The PHPSESSID is 26 characters long.
I have assciated this iRule with a Universal persistence profile and applied to Virtual Server.
Whats confusing me is how to check the server response using HTTP:: ?
This topic was been touched on before:
https://devcentral.f5.com/Community...fault.aspx
Any guidance here greatly appreciated. I'm consuming a *lot* of iRule doco in the process of getting this working. Way cool stuff
3 Replies
- nitass
Employee
I would like to setup an iRule to track the phpsessid in HTTP request/responses and persist to the correct server.where is phpsessid in http response? is it in cookie or custom http header? - hoolio
Cirrostratus
Hi Colin, - colincashin_171
Nimbostratus
Thanks nitass@ and hoolio@
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 🙂
Recent Discussions
Related Content
* 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