Jonathan Matthews
January 21, 2014 08:50AM
On 21 January 2014 13:40, WheresWardy <nginx-forum@nginx.us> wrote:
> I don't think it's a regex issue, because if I add an additional proxy_pass
> inside the nested location block, I then get a valid request. Additionally,
> any headers set inside the outer location block don't appear, but then if I
> duplicate them inside the nested location block, they then appear (just the
> once).

You may have multiple things to solve here.

Your line

location \.(txt|css) {

looks like a regex, but you're not telling nginx it /is/ a regex. I
wouldn't expect anything to work until you fix that.

Secondly, the inheritance behaviours you're seeing are as I'd expect:

1) I don't believe proxy_pass statements are inherited, both as you're
seeing from outer-location{} to inner-location{} but also from, for
example, server{} to location{}. You need to define each proxy_pass
where you want it to be used.

2) add_header (again, in my understanding) is a slightly different
beast: it *is* inherited, outer to inner, but only if you *don't*
re-use it in the inner location. As soon as you use it inside the
inner location, all the inherited add_header directives are forgotten.
Again - that's what I /think/ is the case - I welcome others to
correct me if I'm misremembering ...

Cheers,
Jonathan

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nested location block for merging config returns 404?

WheresWardy January 21, 2014 08:29AM

Re: Nested location block for merging config returns 404?

Jonathan Matthews January 21, 2014 08:36AM

Re: Nested location block for merging config returns 404?

WheresWardy January 21, 2014 08:40AM

Re: Nested location block for merging config returns 404?

Jonathan Matthews January 21, 2014 08:50AM

Re: Nested location block for merging config returns 404?

WheresWardy January 21, 2014 08:59AM

Re: Nested location block for merging config returns 404?

Jonathan Matthews January 21, 2014 09:12AM

Re: Nested location block for merging config returns 404?

Valentin V. Bartenev January 21, 2014 11:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 126
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready