You can use the -glob flag on switch to enable wildcards. By default, switch uses -exact to require exact matches. Here is an example:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/search/*" { pool search }
"*/int_search/" { pool search }
"/pictures/" { node 10.4.43.1 80 }
"/" { HTTP::redirect "https://[HTTP::host]/IMT/LoginAction.go" }
default {
pool www
}
}
}
/search/* would match anything starting with /search/. */int_search/ would match anything ending with /int_search/. /pictures/ would match only requests to exactly that URI.
For details on switch options, check the TCL page (
Click here). Note that the -nocase flag described in the TCL page is not enabled for iRules. If you want to perform a case insensitive comparison, set the URI to lower case using 'switch -glob [string tolower [HTTP::uri]]'.
Aaron