Forum Discussion
How to specify a pool member based on Headers?
For testing purposes I would like to be to able to specify which pool member I would like to test. I thought that the best would be an iRule which looks the the header for something like "server1" or "server2" and wrap that in a conditional, or if, elseif, defaults statment to direct to pool memebers and default to local pool if nothing matches.
I'm very new to F5 and completely new to irules, so I am looking for some guidance if possible.
Thanks in advance.
1 Reply
- Kevin_Stewart
Employee
You can technically perform pool member selection on any request criteria. Example:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { switch [string tolower [HTTP::header POOLSELECT]] { "member1" { pool $default_pool member 10.200.0.1 80 } "member2" { pool $default_pool member 10.200.0.2 80 } "member3" { pool $default_pool member 10.200.0.3 80 } } }where POOLSELECT is an arbitrary that you must inject with an arbitrary value. You may find, however, that injecting an HTTP header with a browser would be challenging. So an easier option may be to use the HTTP URI, or specifically a query string. Example:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "nodeselect=" } { switch [string tolower [URI::query [HTTP::uri] nodeselect]] { "member1" { pool $default_pool member 10.200.0.1 80 } "member2" { pool $default_pool member 10.200.0.2 80 } "member3" { pool $default_pool member 10.200.0.3 80 } } } }where nodeselect is a query string parameter like this:
http://www.example.com/foo/bar?nodeselect=member1
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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