小编Flo*_*oel的帖子

Apache2 无法设置标头“连接”和“升级”

我正在努力通过反向代理设置 websocket 连接。我终于有了 Nginx 的工作配置,但我更喜欢使用 Apache2。

这些是 Nginx 中所需的配置行:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Run Code Online (Sandbox Code Playgroud)

我尝试将它们翻译为 Apache2,但似乎不起作用:

<If "%{HTTP:upgrade} == 'websocket'">
  RequestHeader add Upgrade "websocket"
</If>
RequestHeader set Connection "upgrade"  
Run Code Online (Sandbox Code Playgroud)

Apache2 只是忽略这些命令。当我更改标头名称时,它们不再被忽略,但这对我没有帮助:

RequestHeader set X-Connection "upgrade"
Run Code Online (Sandbox Code Playgroud)

所以:Apache2 似乎忽略了“Upgrade”和“Connection”标头的更改。

(我正在使用一个调试服务器,它打印收到的所有 HTTP 请求及其所有标头 - 因此我可以直接比较 Nginx 和 Apache2 请求 - 因此我知道 Apache2 正在忽略我的命令。)

我如何才能在 Apache2 中实现此功能?

apache websocket

2
推荐指数
1
解决办法
3668
查看次数

标签 统计

apache ×1

websocket ×1