如何解决稍后的proxy_set_header是否会覆盖同一位置块中的先前的proxy_set_header?
我找不到任何文件明确说明后续的nginx proxy_set_header
指令是否会覆盖同一块中的较早指令。
如下所示,我在一个位置块中有3个proxy_set_header Connection some_value
指令(因为每个包含的代码段文件中有1个,之后是一个覆盖它们)。
我以为这是行得通的,但是最近我发现了一些错误,这表明这不是问题所在(与该问题并不相关)。
这是我的配置中的nginx位置块(以及$connection_upgrade
的先前定义):
map $http_upgrade $connection_upgrade
{
default upgrade;
'' close;
}
location ~ /api/v[0-9]+/(users/)?websocket$
{
proxy_pass http://mattermost_upstream;
include snippets/proxy_websocket_params.conf;
include snippets/proxy_params.conf;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
}
snippets/proxy_websocket_params.conf
:
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
snippets/proxy_params.conf
:
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。