Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Aug 01, 2012

lb::select question

in the irule

 

 

 

 

if { xxxx} {

 

pool cjj$env

 

}

 

 

 

I want to define this $env at the top of this irule,however it should know which pool the traffic is sent,in my case it is cjjsomething.

 

 

can I use LB::select to firstly make sure which pool it use and then define the $env

 

 

?

 

 

if it can be done so,how to write irule

 

 

1 Reply

  • Robbie, what do you mean "it should know which pool the traffic is sent"?

    if you want to make sure a pool exists before using it, use 'catch', like this irule:

    
    when HTTP_REQUEST {
       set POOL [substr [string tolower [HTTP::host]] 0 ":"]
       if { [catch { pool $POOL } ] } {
         set POOL default_pool
       }
      pool $POOL
    }
    

    This irule attempts to use a pool that matches the Host header sent by the browser, and if it does not exist sends traffic to default_pool.