If Extend

From SEnginx
Jump to: navigation, search

Contents

if Extend

Synopsis

The "If Extend" module extends the "if" directive of the original NGINX "rewrite" module. It has the following features:

  • Supports matching multiple conditions and the matching conditions can be "and" or "or".
  • Except for the original "if" condition operators, also supports:
    • <
    • >
    • !< or >=
    • !> or <=

Directives

ifall

Syntax ifall (condition 1) (condition 2) ... {...}
Default
Context Server, Location

Specify multiple conditions. If all conditions are true, then execute the directives inside the braces"{}". This directive has the same behavior as the original "if" directive, but the following condition operators are added:

  • <
  • >
  • !< or >=
  • !> or <=


Example:

ifall ($remote_addr = 192.168.1.1) ($http_user_agent ~ 'Mozilla') ($server_port > 808) {
                return 404;
}

ifany

Syntax ifany (condition 1) (condition 2) ... {...}
Default
Context Server, Location

Specify multiple conditions. If any condition is true, then execute the directives inside the braces "{}". The other parts are the same as the "ifall" directive.

Personal tools
Namespaces

Variants
Actions
Navigation
In other languages
Toolbox