Binary logic in "if" directive

Maxim Dounin mdounin at mdounin.ru
Thu Oct 22 17:03:55 MSD 2009


Hello!

On Thu, Oct 22, 2009 at 04:04:32PM +0400, Igor Katson wrote:

> Is it possible to combine several conditions in the if directive, like
> 
> condition1 AND condition2 OR condition3
> 
> ?
> 
> Or at least just condition1 AND condition2?

No.

Workaround is to use set + regex checks in if, e.g.

    set $blah "$arg_a:$arg_b";

    if ($blah ~ ^a:b$) {
        ...
    }

Note though that if is evil.  Search list archives for details.

Maxim Dounin





More information about the nginx mailing list