proxy_set_header directives don't inherit from father context

foxgab nginx-forum at
Wed Jul 5 05:41:23 UTC 2017

i found if i didn't configure any proxy_set_header directives in a context,
it will inherit those directives from father context automatic, but if i set
one in current context,  the inheritance won't work.
my configration is like bellow:

http {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $host;
    server {
        listen 80;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        location / {
             proxy_pass http://huiju_nginx_ppr1;

i expected the X-Forwarded-For and X-Forwarded-Proto header will be set, but
it didn't.
what happend?

Posted at Nginx Forum:,275301,275301#msg-275301

More information about the nginx mailing list