Nested location block for merging config returns 404?

Jonathan Matthews contact at jpluscplusm.com
Tue Jan 21 13:35:24 UTC 2014


On 21 January 2014 13:29, WheresWardy <nginx-forum at nginx.us> wrote:
> I just get a 404 returned for the previously workings URLs:
>
> location ~ /(dir1/)?dir2/ {
>   location \.(txt|css) {
>     add_header X-My-Static value2;
>   }
>   add_header X-My-Header value1;
>   proxy_pass http://myproxy;
> }
>
> Can location blocks actually be nested in this way?

I believe they can be, staticprefix-inside-regex as you've done. The
norm is to have regex-inside-staticprefix, and it's usually done for
performance reasons. I suggest you've made an error in not marking
your inner location as a regex, however, and this may be causing your
404s.

Jonathan



More information about the nginx mailing list