]> git.kaiwu.me - nginx.git/commit
Predicate locations
authorRoman Arutyunyan <arut@nginx.com>
Sun, 29 Mar 2026 06:47:49 +0000 (10:47 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Wed, 26 Aug 2026 11:14:20 +0000 (15:14 +0400)
commit5f54125dde0d144476155d8964f6ec3d449f578d
tree5d2927268f9313e8964ec9a25e892b9485cd5c2d
parent8fa349cef4c1760be9a1acad629cc087f802bb14
Predicate locations

A predicate location name starts with '$' and is interpreted as a
string evaluated at runtime, and its value is used to route the
request into the location.  A predicate location matches if the
string evaluates to a non-empty value not equal to "0".  At each
nesting level, the first matching predicate location in the
configuration order is chosen.  Predicate locations are matched
after prefix and regex locations.  They are not matched if an exact
or a regex location matched, or if the longest matching prefix location
has the "^~" modifier.  Predicate locations can be nested inside
other location types and can contain nested locations of their own.

Example:

map $arg_foo $pred {
    bar  1;
    qux  1;
}

location $pred {
    root html;
}
src/http/modules/ngx_http_proxy_module.c
src/http/ngx_http.c
src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.h