Forum Discussion
IRule to select IRule doesn't work even if the condition triggers
- Apr 26, 2021
To know what pool was selected, maybe you have lot of pool selection logic or possibly the default may have been selected too, to know what's happening in HTTP_REQUEST, use this,
when HTTP_REQUEST { if { [HTTP::header exists testing] } { log local0. "Pre Pool selected is [findstr [LB::server pool] "" 8 ]" pool pool-troubleshooting foreach aHeader [HTTP::header names] { log local0. "Post Pool selected is [findstr [LB::server pool] "" 8 ]" log local0. "Redirecting to troubleshooting pool HTTP REQUEST HEADER $aHeader: [HTTP::header value $aHeader]" } } }
So if you see your intended pool not selected, you can do this,
when LB_SELECTED { if { [LB::server pool] == "/Common/DEFAULT-POOLNAME-443" && [active_members pool-troubleshooting] > 0 } { pool pool-troubleshooting LB::reselect } }
There's the classic with checking the spelling of the pool, and if it is the right server in the pool. Checking if there's a preceeding or proceeding irule that "overwrites" your new settings.
That aside. I see no actual issue with your irule. Suggestions
- Try selecting the specific pool member: pool named_pool member named_member port even if there's only one server
- Use the node command: node x.x.x.x 80 (or whatever port)
- Try reselecting the pool in a later event.
when HTTP_REQUEST {
set vtrouble False
if { [HTTP::header exists testing] } {
set vtrouble True
foreach aHeader [HTTP::header names] {
log local0. "Redirecting to troubleshooting pool HTTP REQUEST HEADER $aHeader: [HTTP::header value $aHeader]"
}
}
}
when LB_SELECTED {
if { $vtrouble == True} {
LB::reselect pool pool-troubleshooting
}
}
I'm pretty sure there's a different reselect command, but I can't recall it.
I mostly give above suggestions as I've run into a similar situation before, where changing the expression from pool to node solved the issue. No clue why. I had 30 other rules where I used the same pool command with a different pool.
- sam_kalApr 27, 2021Altostratus
Thanks for responding to the question and I got hint from your answer to check the proceeding and preceding rules. I assumed that moving rules up and down change their precedence but realized later that it was priority which basically defines that.
Tried first two options that didn't helped and then assigned a high priority to the condition/irule and it worked.
Thank you again.
Recent Discussions
Related Content
* 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