Forum Discussion

Sachin_M_258695's avatar
Sachin_M_258695
Icon for Nimbostratus rankNimbostratus
Apr 15, 2018

Syntax Required -I Rule

Hi,

I have the below Exisiting Irule which is working fine.

switch -glob $HOST { "abc.com" { if { [class match $SRC equals WHITELIST-IPs] } { return } if { [class match $SRC equals Tool_star_IPs] } { return }

                  else { drop }
        }

} }

I want to indroduce one more condition with below

If {[string tolower [HTTP::header "User-Agent"]] contains "mozilla" } { return }

I ended up with something like below,

switch -glob $HOST { "abc.com" { if { [class match $SRC equals WHITELIST-IPs] } { return } if { [class match $SRC equals Tool_star_IPs] } { return } If {[string tolower [HTTP::header "User-Agent"]] contains "mozilla" } { return }

                         else { drop }
        }

} }

Which is not working, Infact throwing Syntax err. Kindly help me to add this.

Thanks Sachin M

1 Reply

  • Which behavior do you expect?

     

    Mozilla keyword is included in any browser user-agent string

     

    Can you post your code here with formatting feature?

     

    It can help to understand the code and find the issue!