Welcome! Log In Create A New Profile

Advanced

proxy_set_header on HTTP or Server level

August 30, 2019 01:03PM
Hello,

We recently made some order in our configuration to make it cleaner and readable.
We have moved all reverse proxy related parameters on the HTTP level from the vhosts locations:
----
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_read_timeout 65;
proxy_send_timeout 65;
proxy_connect_timeout 30;
proxy_buffering off;
proxy_buffers 8 64k;
proxy_buffer_size 64k;
proxy_busy_buffers_size 128k;
proxy_http_version 1.1;
proxy_intercept_errors off;
----
As a result we got some issue with the at leas some of them:
----
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
----
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?

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?

Thank you!
Subject Author Posted

proxy_set_header on HTTP or Server level

stmx38 August 30, 2019 01:03PM

Re: proxy_set_header on HTTP or Server level

Francis Daly August 30, 2019 04:26PM

Re: proxy_set_header on HTTP or Server level

stmx38 December 05, 2019 12:59PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 135
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