Forum Discussion

Ashu_2116's avatar
Ashu_2116
Icon for Nimbostratus rankNimbostratus
Sep 07, 2018

Help with i-rule

Hi Can someone please help me with a i-rule requirement? Requirement: The default url https://www.abc.com goes to it defualt server pool. but If the uri is /helloworld then it goes to a different server pool. My i-rule below does not seem to working correctly. All the requests are going to HelloWorld pool.

 

when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] switch -glob $uri { "/HelloWorld" { pool pool_www.abc.com_HelloWorld } “” { pool pool_www.abc.com_default.

 

}

 

} }

 

1 Reply

  • use this code:

    when HTTP_REQUEST { 
        if {[string tolower [HTTP::uri]] starts_with "/helloworld"} { 
            pool pool_www.abc.com_HelloWorld 
        } else{
            pool pool_www.abc.com_default
        }
    }
    

    when you use $1, it means you convert the uri to lowercase... if you compare to /HelloWorld, it will always fail because it contains uppercase.