Forum Discussion

Ravi_75522's avatar
Ravi_75522
Icon for Nimbostratus rankNimbostratus
Feb 02, 2012

Problem with bots redirect

We have defined a robots class, and if any user agent matches an entry in robots class then it redirected to a pool. But the problem is that we want to redirect the traffic to different pool when the agent is googlebot and specific uri then redirect to a different pool altogether. How do we do this.

 

The irule for bots is as below

 

 

when HTTP_REQUEST { if { [matchclass [HTTP::header User-Agent] contains robots] } { pool NeimansBOT } }

 

 

and additional condition is that if there ia request coming from /blog (which is the URI part) and the agent is googlebot then redirect it to different pool.

 

 

Can we have the logic defined as

 

 

when HTTP_REQUEST {

 

if { ([matchclass [string tolower [HTTP::header User-Agent]] contains googlebot]) and ([HTTP::uri] contains "/blog")} { pool xyz }

 

 

elseif { [matchclass [HTTP::header User-Agent] contains robots] } { pool NeimansBOT } }

 

 

 

  • i think the irule could be okay.

    anyway, according to sol9800, the irule should select a pool under every possible condition.

    sol9800: Using an iRule to load balance HTTP requests to multiple pools

    http://support.f5.com/kb/en-us/solutions/public/9000/800/sol9800.html

    e.g.

    when HTTP_REQUEST { 
       if { ([matchclass [string tolower [HTTP::header User-Agent]] contains googlebot]) and ([HTTP::uri] contains "/blog")} { 
          pool xyz 
       } elseif { [matchclass [string tolower [HTTP::header User-Agent]] contains robots] } { 
          pool NeimansBOT 
       } else {
          pool default_pool
       }
    }