ambiguous option "-" in switch

switch -glob [HTTP::header “User-Agent”] { “*x*” - “*y*” - “*z*” { if {!([HTTP::cookie exists “ccc”]) or !([HTTP::cookie exists “jjj”])} { if {[HTTP::uri] contains “ooo”} { return } else { if {[HTTP::cookie exists “aaa”]} { if {[HTTP::cookie value “aaa”] eq “zzz”} { return } }

I met this issue when apply this irule to vip

Mar 2 00:19:07 slot2/tmm2 err tmm2[5253]: 01220001:3: TCL error:xxx-redirect - ambiguous option “-”: must be -exact, -glob, -regexp, or -- while executing "switch -glob [HTTP::header “User-Agent”] { “*x*” - “*y*” - “*z*” { if {!([HTTP::cookie exists “ccc”]) or !([HTTP::cookie exists “jjj”])}…

which stuff trigger this issue?

If the string you’re checking starts with a hyphen it will be mis-interpreted as an option for switch. You can avoid this by using the -- option to terminate the options:

switch -glob -- [HTTP::header “User-Agent”] {

Aaron

great thx

I see this message in our logs as well, and it brought up a question - what happens to the request when this error occurs? Does it exit the iRule? Sends a RESET? Closes the connection?

Thanks, -funkdaddy