Forum Discussion
Jesse_DeFer_418
Nimbostratus
Apr 28, 2005Persistence on URI
I've written the following universal persistence iRule, and it seems to work as intended. Anybody have any comments, suggestions, or improvements? In particular is there a better way than the regexp to do this? The sid is variable length.
when HTTP_REQUEST {
set server_id [ findstr [HTTP::uri] "sid" 4 "&" ]
if {$server_id ne ""} {
regexp {.*\.([0-9]+)$} $server_id match server_num
log "Force persist by sid to server $server_num"
use pool webfarm member 1.1.1.10$server_num 80
} else {
log "No sid, persisting by fallback method"
}
}
2 Replies
- unRuleY_95363Historic F5 AccountThat's pretty trick!
I can't really think of any better way than doing the regexp unless the period is unique. If so, you could instead do another findstr like:
[findstr $server_id "." 1] which will find the period and return the portion following it. - Jesse_DeFer_418
Nimbostratus
Thanks! Unfortunately the period isn't unique. At least I have control over the IP addressing and can do tricks like this without having to maintain a data group.
Tcl is a pretty slick language, I haven't written anything in it before now. Our entire web site was written in Tcl about 7 years ago. It was replaced because it was all CGI and suffered poor scalability, rather than because of problems with Tcl.
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
