Forum Discussion

rodrigo_Benzaqu's avatar
rodrigo_Benzaqu
Icon for Nimbostratus rankNimbostratus
May 13, 2005

Irule from 4.6 to 9

Hi, I´m new on 9.X, can some body help me to translate this rule to 9.X ?

 

 

rule FD_Fetch {

 

if (http_uri starts_with "/fd/") {

 

use pool FD_SERVERS

 

}

 

else if (http_host == "www.mercadolibre.com.ar") {

 

use pool NC3100N

 

}

 

else if (http_host == "www.mercadolivre.com" or http_host == "www.mercadolivre.com.br") {

 

use pool Netcache_3100

 

}

 

else {

 

use pool Mexico

 

}

 

}

6 Replies

  • Try this:

     

     

    rule FD_Fetch {

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] starts_with "/fd/" } {

     

    use pool FD_SERVERS

     

    } elseif { [HTTP::host] equals "www.mercadolibre.com.ar" } {

     

    use pool NC3100N

     

    } elseif { [HTTP::host] equals "www.mercadolivre.com" or \

     

    [HTTP::host] equals "www.mercadolivre.com.br" } {

     

    use pool Netcache_3100

     

    }

     

    else {

     

    use pool Mexico

     

    }

     

    }

     

    }
  • try this

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] start_with "/fd/"}{

     

    pool FD_SERVERS}

     

    elseif {[HTTP::host] equals "www.mercadolibre.com.ar" }{

     

    pool NC3100N}

     

    elseif {[HTTP::host] equals "ww.mercadolivre.com" or [HTTP::host] equals "www.mercadolivre.com.br" }{

     

    pool Netcache_3100}

     

    else {

     

    pool Mexico

     

    }

     

    }

     

  • Thanks Guys,

     

     

    Just another questions, maybe I´ll have 30 differents domains. If I create an Irule with 30 (if), will affect my site performance ?

     

     

    We have like 600 mbts x second.

     

     

    Thanks

     

    Rodrigo.

     

  • One of the developers would probably be a better source for where the threshold is, but at some point it's wise to build a class and use matchclass in your rule.
  • Clear, do you have an example of this rule using the matchclass ?

     

    and how to create a class ?

     

  • class WebURLs {  
     "www.mercadolivre.com"  
     "www.mercadolivre.com.br"  
     } 
      
     when HTTP_REQUEST {  
       if { [HTTP::uri] starts_with "/fd/" } {  
         use pool FD_SERVERS  
       } elseif { [HTTP::host] equals "www.mercadolibre.com.ar" } {  
           use pool NC3100N  
       } elseif { [matchclass [HTTP::host] equals $::WebURLs] } {  
           use pool Netcache_3100  
       }  
       else {  
         use pool Mexico  
       }  
     }