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.
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