Question on syntax of iRule
Hello,
I'm struggling with syntax on the following, and was wondering if anyone had suggestions. I've tried combining Mozilla and Opera using '||', but that seemed to produce the same error (below).
If an IE/Firefox/Chrome client browser attempts to connect to REST Test & no SSO cookie exists, reject.
when HTTP_REQUEST { if { ( [HTTP::header value "User-Agent"] contains "Mozilla" ) or ( [HTTP::header value "User-Agent"] contains "Opera" ) and ([string tolower [HTTP::uri]] matches_regex {restservicestest}) and { not [HTTP::cookie names] contains ".test" } then { reject log local0. "Client browser trying to connect to REST Host:[HTTP::host]; URI = [HTTP::uri] No SSO Cookie Detected, Client IP:[IP::client_addr] has been blocked" } }
}
ERROR Text s/iRule syntax checking:
Exception caught in LocalLB::urn:iControl:LocalLB/Rule::create() Exception: Common::OperationFailed primary_error_code : 17236305 (0x01070151) secondary_error_code : 0 error_string : 01070151:3: Rule [/Common/iRuler_Parse_Test_Rule] error: /Common/iRuler_Parse_Test_Rule:3: error: [parse error: PARSE syntax 366 {syntax error in expression " ( [HTTP::header value "User-Agent"] contains "Mozilla" ) or...": extra tokens at end of expression}][{ ( [HTTP::header value "User-Agent"] contains "Mozilla" ) or ( [HTTP::header value "User-Agent"] contains "Opera" ) and ([string tolower [HTTP::uri]] matches_regex {restservicestest}) and { not [HTTP::cookie names] contains ".test" } then { reject log local0. "Client browser trying to connect to REST Host:[HTTP::host]; URI = [HTTP::uri] No SSO Cookie Detected, Client IP:[IP::client_addr] has been blocked" } }] /Common/iRuler_Parse_Test_Rule:7: error: [missing a script after "if"][ ]
Thank you, Eric