Hi Brett,
A switch statement should allow you to do this easily. See the switch wiki page for more info and examples:
http://devcentral.f5.com/wiki/default.aspx/iRules/switch
Here is a rough interpretation of what you've described. If it's not exactly what you're looking for, you can test and check the /var/log/ltm file to see what's happening. Once you're done testing, comment out the debug log lines and remove the SERVER_CONNECTED event.
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
Check the requested URI with wildcard matching
switch -glob [HTTP::uri] {
"/" {
Exact request for /, send 302 to /UK/
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting / to /UK/"
HTTP::redirect "http://www.domain.com/UK/"
}
"/UK/*" {
Request for a URI starting with /UK/
log local0. "[IP::client_addr]:[TCP::client_port]: Selecting pool_B"
pool pool_B
}
"/USA/*" {
Request for a URI starting with /USA/
log local0. "[IP::client_addr]:[TCP::client_port]: Selecting pool_C"
pool pool_C
}
"/Asia/*" {
Request for a URI starting with /Asia/
log local0. "[IP::client_addr]:[TCP::client_port]: Selecting pool_D"
pool pool_D
}
default {
Request for a URI starting with /Asia/
log local0. "[IP::client_addr]:[TCP::client_port]: Selecting pool_A by default"
pool pool_A
}
}
}
when SERVER_CONNECTED {
You can remove this event when done testing
log local0. "[IP::client_addr]:[TCP::client_port]: selected pool: [LB::server], connected server: [IP::server_addr]:[TCP::server_port]
}
Aaron