Forum Discussion

clgarland_14508's avatar
clgarland_14508
Icon for Nimbostratus rankNimbostratus
Apr 14, 2010

New to irules, need simple uri rule

Just need a simple irule for http requests, if the uri is /test1 use a test1 pool, if the uri is /test2 use test2 pool.

 

 

Thanks!!!!
  • Hi Clgarland,

     

     

    you can use the below IRule:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] equals "/test1" } {

     

    pool test1

     

    } elseif { [HTTP::uri] equals "/test2" } {

     

    pool test2

     

    }

     

    }

     

  • Hi Clgarland,

    You can also use the SWITCH command :

    
    when HTTP_REQUEST {
       switch -glob [string tolower [HTTP::uri]] {
        "/test1" { pool test1 }
        "/test2" { pool test2 }
        default { pool default }
       }
    }
    

    I hope this helps,

    Bhattman