Forum Discussion
unRuleY_95363
Aug 21, 2006Historic F5 Account
Depending on whether or not you actually want case insensitive matches, the switch statement is probably your best bet. Also, avoiding any variables will also help get the absolute best performance from the rule.
Here are two examples, the first one with case sensitivity and the second one without:
when HTTP_REQUEST {
pool demo_192.168.1.195.80
if { [HTTP::host] eq "www.demodomain.com" } {
switch -glob [HTTP::header User-Agent] {
*[sS]lurp* -
*msnbot* -
*[Ff][Aa][Ss][Tt]-* -
*[Tt]eoma* -
*[Gg]ooglebot* {
pool bots.80 Override to new pool
}
default {
pool demo_192.168.1.195.80
}
}
} else {
pool demo_192.168.1.195.80
}
}
when HTTP_REQUEST {
pool demo_192.168.1.195.80
if { [HTTP::host] eq "www.demodomain.com" } {
switch -glob -nocase [HTTP::header User-Agent] {
*slurp* -
*msnbot* -
*fast-* -
*teoma* -
*googlebot* {
pool bots.80 Override to new pool
}
default {
pool demo_192.168.1.195.80
}
}
} else {
pool demo_192.168.1.195.80
}
}