Forum Discussion
Daddy_73321
Nimbostratus
Feb 09, 2010Irule issue
Hello All,
I have an issue with the below irule written to direct the traffic to a node or a pool.
I have a pool CMS-http-pool with below two members.
pool...
SalishSeaSecurity
Altostratus
Feb 10, 2010Renith,
I had a similar problem a few weeks ago (sorry I never got a around to posting a followup here -- if not buried in snow, then I'm buried in work). I opened a ticket with F5 asking why specifying a node kills cookie persistence. I was told, "This is expected behavior...The general reasoning behind this, per my conversation with our engineering services team, is that if a customer decides to use an iRule to select a server, which supercedes all other LB functions on the box, they should be planning to deal with the additional items that the box would normally implement as well, such as persistence and checking pool member status."
In other words, once you select the node, the persistence profile will not function. More accurately (based on my observations) the persistence profile will not function until the BIGIP once again makes the load balancing decision. That's why you'll see the cookie when the browser connects to the "wrong" web server. The fix I used: set the cookie in the iRule to insure that the cookie is set on the first HTTP response. I might add that I did not include code to check pool member status because the code was written at the request of the web team to check specific web server functionality once they had been brought back up from maintenance. However, since your selection criteria is URI, you should be aware that the BIGIP won't honor the node status [if down] once you've manually selected the node (per F5 above). You might want to add a node check; see LB::status.
when RULE_INIT {
set ::bakecookie 0
set ::nodeTo ""
}
when HTTP_REQUEST {
if { [ findstr [string tolower [HTTP::query]] "node=" 5 2 ] != "" } {
log local0. "Found [ findstr [string tolower [HTTP::query]] "node=" 0 7 ]"
need to remove any stale cookies: lumwebprod, fos.web.server, fos.secure.web.server
if {[HTTP::cookie exists "fos.web.server"]} {
HTTP::cookie remove "fos.web.server"
}
if {[HTTP::cookie exists "fos.secure.web.server"]} {
HTTP::cookie remove "fos.secure.web.server"
}
if {[HTTP::cookie exists "lumwebprod"]} {
HTTP::cookie remove "lumwebprod"
}
if {[HTTP::cookie exists "fcspersistslider1"]} {
HTTP::cookie remove "fcspersistslider1"
}
if {[HTTP::cookie exists "JSESSIONID"]} {
HTTP::cookie remove "JSESSIONID"
}
if {[HTTP::cookie exists "UserAgentId"]} {
HTTP::cookie remove "UserAgentId"
}
if {[HTTP::cookie exists "runId"]} {
HTTP::cookie remove "runId"
}
switch [ findstr [string tolower [HTTP::query]] "node=" 5 2] {
01 { set ::nodeTo 192.168.100.2 }
02 { set ::nodeTo 192.168.100.5 }
03 { set ::nodeTo 192.168.100.8 }
04 { set ::nodeTo 192.168.100.11 }
}
HTTP::path "/"
pool Lum_prod_pool_80 member $::nodeTo 80
log local0. "Setting pool member node to $::nodeTo"
set ::bakecookie 1
}
}
when HTTP_RESPONSE {
if { $::bakecookie == 1 } {
scan $::nodeTo "%u.%u.%u.%u" a b c d
set cookie "[format %u [expr ($d<<24)|($c<<16)|($b<<8)|$a]].[expr 256*80].0000"
HTTP::cookie insert name "lumwebprod" value $cookie path "/"
All done for first response
set ::bakecookie 0
}
}
Regards,
Jason
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
