Forum Discussion
Gary_Bright_120
Nimbostratus
Mar 13, 2006Persist iRule based on URI
Hi there I'm trying to write an iRule that will allow us Admins the choice of selecting a pool member and have persistence with that member.
At the moment we have a persistance profile or source_a...
unRuleY_95363
Mar 16, 2006Historic F5 Account
Oh, yep. That is a bug. Using direct pool member selection doesn't cause a persistence record to be created (or a persist cookie to be inserted). You can add the persist record in an LB_SELECTED event like so (I've also made a few other optimizations):
when HTTP_REQUEST {
switch -glob [URI::decode [string tolower [HTTP::uri]]] {
*gb=1* {
pool webpool member 1.1.1.1 80
set need_add_persist 1
}
*gb=2* {
pool webpool member 2.2.2.2 80
set need_add_persist 1
}
*gb=3* {
pool webpool member 3.3.3.3 80
set need_add_persist 1
}
*gb=4* {
pool webpool member 4.4.4.4 80
set need_add_persist 1
}
*gb=* {
persist none
log "Persist Turn Off"
}
}
}
when LB_SELECTED {
if {[info exists need_add_persist]} {
persist add source_addr [IP::client_addr] 1800
unset need_add_persist
}
}
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