A Challenging Config

Maxim Dounin mdounin at mdounin.ru
Tue Jun 26 06:44:03 UTC 2012


Hello!

On Tue, Jun 26, 2012 at 01:35:59PM +1000, SplitIce wrote:

> Ok thanks, my problem isnt with the matching order (bad explination on my
> part) but more with the matching procedure
> 
> e.g
> 
> location ~ to_cache {
>      proxy_cache ....;
>      proxy_pass ....;
> }
> 
> location ~ not_to_cache {
>      proxy_cache off;
>      proxy_pass ....;
> }
> 
> /
> If the url /abc-not_to_cache-def/ is passed to nginx does the server
> execute both the matches (to_cache, then not_to_cache with not_to_cache
> overriding to_cache) or does it stop after the first match (to_cache)?

Quoting from http://nginx.org/r/location, the link already suggested:

: Then regular expressions are checked, in the order of their 
: appearance in a configuration file. A search of regular 
: expressions terminates on the first match, and the corresponding 
: configuration is used.

[...]

Maxim Dounin



More information about the nginx mailing list