@
nikoo 应该是直接 if ( $cookie_antiscanpassword),不行的话正则处理 if ( $cookie_antiscanpassword~ .+)
参考
http://nginx.org/en/docs/http/ngx_http_rewrite_module.htmla variable name; false if the value of a variable is an empty string or “ 0 ”;
Before version 1.0.1, any string starting with “ 0 ” was considered a false value.
comparison of a variable with a string using the “=” and “!=” operators;
matching of a variable against a regular expression using the “~” (for case-sensitive matching) and “~*” (for case-insensitive matching) operators. Regular expressions can contain captures that are made available for later reuse in the $1..$9 variables. Negative operators “!~” and “!~*” are also available. If a regular expression includes the “}” or “;” characters, the whole expressions should be enclosed in single or double quotes.
checking of a file existence with the “-f ” and “!-f ” operators;
checking of a directory existence with the “-d ” and “!-d ” operators;
checking of a file, directory, or symbolic link existence with the “-e ” and “!-e ” operators;
checking for an executable file with the “-x ” and “!-x ” operators.