Forum Discussion
sam_kal
Altostratus
Apr 26, 2021IRule to select IRule doesn't work even if the condition triggers
Problem Statement: Trying to create a I-Rule to forward traffic to a pool "pool-troubleshooting" in case a header is passed in a request, the "if" condition triggers as the logs are part of the loop...
- 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 } }
jaikumar_f5
Noctilucent
Apr 26, 2021To 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
}
}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