Forum Discussion

yuni's avatar
yuni
Icon for Altostratus rankAltostratus
Jul 16, 2019

iRule syntax error

Hello Could you please help me correcting my following iRule? I am newbie to iRules, so I couldn't figure out the error. when HTTP_REQUEST {   switch -exact -- [HTTP::uri] contains "/info/c...
  • Lee_Sutcliffe's avatar
    Jul 16, 2019

    You're syntax is slightly off, try this

    when HTTP_REQUEST {
        switch [HTTP::uri] {
            "/info/capacity" {
                if {[active_members pool_test1 ] >0 } {
                    pool pool_test1 
                } else {
                    pool pool_sorry
                }
            }
            "/execution/v1" {
                if {[active_members pool_test2 ] >0 } {
                    pool pool_test2
                } else {
                    pool pool_sorry2
                } 
            }
        }
    }