nginx配置中,proxy_set_header可以放在http,server,loaction中

逻辑上讲,下面loaction的配置应该会继承上面的proxy_set_header

但Nginx有一个限制

proxy_set_header directives issued at higher levels are only inherited when no proxy_set_header directives have been issued at a given level.

就是说,当location里写的有其它的proxy_set_header时,则无法继承高层server中定义的proxy_set_header的设置

如果location想继承上面定义的proxy_set_header,则location里不能proxy_set_header指令