WIth the following configuration:
server {
listen 80;
listen [::]:80;
location / {
location ~* "^/[[:alnum:]]+$" {
default_type text/plain;
return 200 "KO";
}
}
location ~* "^/test" {
default_type text/plain;
return 200 "OK";
}
}
I noticed that calling example.org/test returns KO.
The location docs
<http://nginx.org/en/docs/http/ngx_http_core_module.html#location> say the
longest prefix match ('/') is remembered then regex are checked. Since the
'test' regex is on the same level, you would expect higher precedence for
it compared to the embedded 'alnum' one, which is one level deeper.
If secondary-level regex locations have the same priority as others, you
are basically doomed trying to prioritize regex locations between each
others using prefix locations at an upper-level.
Where am I wrong?
---
*B. R.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx