Forum Discussion
thunderbird_920
Jul 15, 2011Nimbostratus
Cookies persistency
I am using cookies to maintain the persistency for user to the web servers. The cookies was created by the web server. Below is the irule for the cookies persistency.
when HTTP_RESPONSE {
if { [HTTP::cookie exists "servercookie"] } {
persist add uie [HTTP::cookie "servercookie"]
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "servercookie"] } {
persist uie [HTTP::cookie "servercookie"]
}
}
The problem that I encounter here is the user will be not directed to other web servers if the current web server that he connected is down because the persistency for that current server is still there. I have 4 web servers and the load balancing method is using Round Robin.
Can i modify irule to redicrect the traffic to other web servers? Give show me example?
- Colin_Walker_12Historic F5 AccountIf you're manually forcing the user to a particular server based on the cookie, you might want to add an LB_FAILED event in the iRule to remove persistence if you're ever not able to connect to the back-end server. Simply putting a persist none inside an LB_FAILED might get you there.
- thunderbird_920NimbostratusBy referring to the link http://support.f5.com/kb/en-us/solutions/public/10000/200/sol10281.html, i edit the IRules to somethings as shown below. Is it correct?
- hooleylistCirrostratusThat looks like a good start. Is there a reason that you're not using cookie insert persistence instead though? With cookie insert persistence LTM will manage this for you automatically without depending on an app-set cookie. Also, with any HTTP property based persistence, you'll want to enable a OneConnect profile on the virtual server. If you're using SNAT on the serverside connections you can use the default OneConnect profile with a /0 source mask. If you're not using serverside source address translation, you can create a custom OneConnect profile with a /32 source mask. See this article for details:
- thunderbird_920NimbostratusUser is not directly connect to the virtual server of the web servers. In between, there are other another F5 and others servers involved. Therefore, it have to depend on the cookies issued by servers. Thank you for your help.
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