Forum Discussion
sandman748
Nimbostratus
Sep 23, 2020Please help with irule for pool selection based on custom http header
Hi all,
Could someone assist me with an irule that would look at a custom header callled X-Server-Pool. If "xyz" then this pool, if "abc" then this pool, else default.
I think this is a starting point but it doesnt appear to be working
- when HTTP_REQUEST {
- if { [HTTP::header exists X-SERVER-POOL] and [HTTP::header X-SERVER-POOL] equals "xyz" } {
- pool xyz
- } elseif [HTTP::header exists X-SERVER-POOL] and [HTTP::header X-SERVER-POOL] equals "abc" } {
- pool abc
- }
- }
- }
If no header exists it would hit default pool assigned to vip?
Hi sandman748,
Can you look logs with this:
when HTTP_REQUEST { if { [HTTP::header exists X-SERVER-POOL] } { log local0. "X-Server-Pool: [HTTP::header X-SERVER-POOL]" switch [HTTP::header X-SERVER-POOL] { "xyz" { pool xyz } "abc" { pool abc } } } }
If no header exists, it hits the default pool. If no default pool exists, it drops. You can add default pool configuration in iRule with using else or switch.
when HTTP_REQUEST { if { [HTTP::header exists X-SERVER-POOL] } { log local0. "X-Server-Pool: [HTTP::header X-SERVER-POOL]" switch [HTTP::header X-SERVER-POOL] { "xyz" { pool xyz } "abc" { pool abc } default { defaultpool } } } }
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