Forum Discussion
Rhys_137883
Nimbostratus
Nov 17, 2013How 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...
Kevin_Stewart
Employee
Nov 17, 2013You 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
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