proxy_set_header on HTTP or Server level
Francis Daly
francis at daoine.org
Fri Aug 30 20:25:11 UTC 2019
On Fri, Aug 30, 2019 at 01:03:57PM -0400, stmx38 wrote:
Hi there,
> As per documentation -
> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header:
> Context: http, server, location
>
> > These directives are inherited from the previous level if and only if
> there are no proxy_set_header directives defined on the current level.
> Does it mean that if at least one of the proxy_set_header is defined on
> location level we should define all other on this level because it broke
> inheritance?
Yes, that is what it means.
The request is handled in a location{}, with proxy_pass.
If there is any proxy_set_header in that location{}, then only those
proxy_set_header values are used.
If not, then if there is any proxy_set_header in the surrounding server{},
then only those proxy_set_header values are used.
If not, then if there is any proxy_set_header in the surrounding http{},
then only those proxy_set_header values are used.
In the same way, if "proxy_busy_buffers_size" is set in the location{},
that value is used; if not, if "proxy_busy_buffers_size" is set in the
server{}, that value is used; if not, if "proxy_busy_buffers_size" is set
in http{}, that value is used.
In general in nginx (with a few exceptions) directive inheritance is
"not at all", or "by replacement".
> Per our experience, these directives only work on location level. They do
> not apply when we set them up on HTTP or Server level.
>
> Why may be wrong with our configuration?
Can you show a sample configuration, if there is a problem?
But if it has "proxy_set_header" in the location{}, then any
proxy_set_header outside that location is irrelevant for this request.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list