Forum Discussion
Chris_R_123579
Nimbostratus
Apr 04, 2013variable getting reset during irule execution
'll try to be as descriptive as I can since I'm not well trained in our F5 load balancers ways. Basically I have an iRule that looks something like this(pseudocode):
when HTTP_REQUEST {
set host_...
Chris_R_123579
Nimbostratus
Apr 04, 2013I used your test code and host_num does exist. I don't ever see a host_num does not exist in my logs.
But my problem occurs in my irule like so:
when HTTP_REQUEST {
log local0. "here"
set host_num 0
if { [string tolower $uri] starts_with "/serv" } {
log local0. "prefix redirect initiated"
if { [string tolower $uri] matches_regex {serv[\d]+} } {
scan $uri /serv%d host_num
set path "/"
log local0. "uri match found $host_num"
} else {
scan $uri /serv%d%s host_num path
log local0. "uri match not found assert $host_num"
}
HTTP::uri $path
}
when LB_SELECTED {
log local0. "LB here"
if { $host_num != 0 } {
redirect the request to the appropriate member
switch $host_num {
1 {
LB::reselect pool SERV member 10.10.10.2
log local0. "prefix redirect selecting /serv1"
}
} }
My problem occurs when LB_SELECTED executes. For some reason $host_num is always being reset to 0.
It's almost like any user who tries to use the prefix redirect to select a specific server, will get the host_num variable set, but before the LB_SELECT function executes the session/connection is cleared and they get host_num = 0 or something.
Any ideas?
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