Forum Discussion
dennypayne
Apr 15, 2009Employee
Posted By mlameyer on 04/14/2009 5:04 PM
I want this iRule to run only if a bot user-agent comes along, thoughts?
Well it's going to run on every HTTP_REQUEST regardless, but I'd flip it around so that you don't do the active_members check unless you've already matched the bots User-Agent. That might perform a little better since user requests won't trigger the active_members check (and in either version the matchclass runs anyway).
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } {
if { [active_members p_PUB_botfarm] > 0 } {
pool p_PUB_botfarm
} else {
return
}
}
}
(I think I got the brackets correct there but double-check...)
I would test this throroughly though to make sure you don't need to specify the default pool like Aaron said.
Denny