Can someone shed some light on why this doesn't work the way one would expect it to?
In the following nginx configuration, the assumption is that the first nginx will go with the regex-matching image extensions block, and only afterwards would it enter the inner block where the ^~
takes preference over everything else.
It seems nginx is looking at the bigger picture regardless of scope, and matching ^~ /images
before the outer regex extension block for a request like /images/something.png
?
location ~* \.(css|js|jpg|png|gif|ico)$ {
expires 7d;
add_header Image-By-Extension 1;
}
location / {
location ^~ /images {
add_header Image-By-Folder 1;
...
}
}