Forum Discussion

SamBillings1's avatar
SamBillings1
Icon for Nimbostratus rankNimbostratus
Apr 30, 2020

getting error while creating an Irule " extra tokens at end of expression"

Hello Experts,

 

I wanted to test a simple irule, after creating an irule and clicking on finished button for changes to take place I'm getting an error which says " extra tokens at end of expression " . I'm very weak at scripting . can any one please help me with this

 

this is my simple I rule

 

when HTTP_REQUEST {

 if { [HTTP::header User-Agent] contains "ipad" } {

    pool pool2}

 elseif { [HTTP::header User-Agent] conatins "Andriod" } {

    pool pool3 }

 else {

    pool Pool1 }

}

 

============================================================

this is the error i get upon clicking finish button

 

01070151:3: Rule [/Common/MOBILE] error: /Common/MOBILE:4: error: [parse error: PARSE syntax 128 {syntax error in expression " [HTTP::header User-Agent] conatins "Andriod" ": extra tokens at end of expression}][{ [HTTP::header User-Agent] conatins "Andriod" }]

 

 

1 Reply

  • @SamBillings,

    Here try this,

    when HTTP_REQUEST {
       if {[HTTP::header "User-Agent"] contains "ipad"} then {
          pool pool2 }
       elseif {[HTTP::header "User-Agent"] contains "Andriod"} then {
          pool pool3 }
       else {
       pool Pool1
        }
    }