Forum Discussion

avir_225604's avatar
avir_225604
Icon for Nimbostratus rankNimbostratus
Oct 06, 2015

i rule syntax issue

HI Team,

 

I am a newbie on f5 irule..I am learning the irule thing now..One the thing i am facing issue as follows:

 

my i rule code is like this:

 

when HTTP_REQUEST { if{ [HTTP::header User-Agent]contains "iPad"} { pool pool2 } elseif{ [HTTP::header User-Agent]contains "Android"} { pool pool3 } else{ pool pool1 }

 

}

I am getting the error message like below:

 

01070151:3: Rule [/Common/acme] error: line 2: [parse error: extra characters after close-quote] [} { pool pool2 } elseif{ [HTTP::header User-Agent]contains "Android"} { pool pool3 } else{ pool pool1 } ] line 6: [parse error: extra characters after close-quote] [} { pool pool3 } else{ pool pool1 } ] line 7: [undefined procedure: pool pool3 ] [{ pool pool3 }

 

else{]

can anybody please help on this..where I am wrong on this since I have just copy paste form an existing working one..I have evaluation version of 11.3 for 90 days....the working one is lab licensed and 11.6..please help on this

 

3 Replies

  • Looks fine to me - try formatting like I have....?

    when HTTP_REQUEST { 
        if { [HTTP::header User-Agent] contains "iPad"} { 
            pool pool2 
        } elseif { [HTTP::header User-Agent] contains "Android"} { 
            pool pool3 
        } else { 
           pool pool1 
        }
    }
    
  • yesssssss...it took now..many thanks..wanted to know did i miss anything?

     

    • robert-orange's avatar
      robert-orange
      Icon for Nimbostratus rankNimbostratus

      Just tried how you typed it originally and it failed for me too.

      It's all about the formatting.