Forum Discussion
F5 irule: HTTP_REQUEST switch -glob HTTP::uri not working with pool
This works correctly for me. I recommend checking /var/log/ltm to see if there is an error on the request. If not, add some logging, as in:
when HTTP_REQUEST {
log local0. "uri = [HTTP::uri]"
switch [HTTP::uri] {
"/test1" {
log local0. " ... matched"
pool test_pool
}
default {
log local0. " ... did not match"
}
}
}
It would fail if the request-uri has something else in it or if the pool no longer exists.
For what it's worth, if this is the only match case, then switch isn't necessary (you can use if), the -glob isn't needed and degrades performance slightly, and you should consider using HTTP::path rather than HTTP::uri so that the expanded string is smaller, as in:
when HTTP_REQUEST { if { [HTTP::path] eq "/test1" } { pool test-pool } }
And, of course, if you are using 11.4+, you may consider using a Local Traffic Policy instead:
- fr55tam_245172Jan 27, 2016NimbostratusThank you! The logging is showing as matched but pool does not load? As I mentioned above when I set this pool to default & hit the VIP over http, it loads fine? Could you assist further? Forgot to mention I will have additional pools that are going to be used depending on the HTTP URI
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