Forum Discussion
Brian_Kinsey_10
Nimbostratus
Jul 09, 2007Cookie Persist on Pool Member in iRule?
I have an iRule that looks for a string in a URI and sends a client to one of five pools depending on that string. The issue is that after the first connection (where the client logs in), any links th...
Deb_Allen_18
Jul 16, 2007Historic F5 Account
To optimize, you can use the tcl "switch" command with the "-glob" option to do wildcard matches against the URI:
when HTTP_REQUEST {
persist cookie insert
switch -glob [string tolower [HTTP::uri]] {
"*string1*" -
"*string2*" {
if { [active_members Pool_1] >= 1 } {
pool Pool_1
} else {
HTTP::redirect http://maintenance.domain.com
}
}
"*string3*" -
"*string4*" {
if { [active_members Pool_2] >= 1 } {
pool Pool_2
} else {
HTTP::redirect http://maintenance.domain.com
}
}
...
default {
if { [active_members Pool_all] >= 1 } {
pool Pool_all
} else {
HTTP::redirect http://maintenance.domain.com
}
}
}
}Enabling a OneConnect profile on the virtual server should allow smoother transition between pools. Not sure why a session cookie wasn't working as well as a timed cookie, though.
HTH
/deb
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