Nginx not respecting locations execution ordering

Reinis Rozitis r at roze.lv
Tue Apr 17 22:21:05 UTC 2018


> When I access URL : domain_name_dot_com/media/files/image.jpg
> 
> The Header response is X-Location-Order: Second
>
> I want it to be using the first location for all URL's that match that not the regex location can anybody help ?


Change the first block to:

location ^~/media/files/ {
add_header X-Location-Order First;
}

"If the longest matching prefix location has the “^~” modifier then regular expressions are not checked." 

http://nginx.org/en/docs/http/ngx_http_core_module.html#location

rr



More information about the nginx mailing list