Forum Discussion

Erik_Durand_277's avatar
Erik_Durand_277
Icon for Nimbostratus rankNimbostratus
Aug 31, 2008

uri redirect to pool

I am an iRule novice and I am trying to create an iRule that will redirect to two different pools based on URI. So far I have come up with the following with the iRule editor, but need to validate this will work as well as have a way of specifying a default pool:

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri]] {

 

"*/us/*" { pool pool_us }

 

"*/uk/*" { pool pool_uk }

 

}

 

}

 

Does this look correct? How do I specify a default pool?

 

 

Thanks in advance!

2 Replies

  • That looks good. You can add a default case using the keyword default. If the string you're looking for is part of the path, you could replace HTTP::uri with HTTP::path. HTTP::path doesn't include the query string, so it might be more specific for your case.

     
     when HTTP_REQUEST { 
        switch -glob [string tolower [HTTP::path]] { 
           "*/us/*" { 
              pool pool_us 
           } 
           "*/uk/*" { 
              pool pool_uk 
           } 
           default { 
              pool default_pool 
           } 
        } 
     } 
     

    Aaron