【发布时间】:2015-10-20 08:39:18
【问题描述】:
我有问题。 Apache 侦听白色 ip 并代理所有请求 /ssd 上的 nginx 将请求 /city-dashboard 代理到具有 websockets 的另一台服务器。在 apache 配置中:
ProxyPass /ssd/ http://10.127.32.24
ProxyPassReverse /ssd/ http://10.127.32.24
nginx 配置: 在 nginx.conf 上:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/conf.d/*.conf;
在 default.conf 上
location /city-dashboard/stream {
proxy_pass http://10.127.32.24:5000/stream;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
请求标头:
Connection: Upgrade
Upgrade: Websocket
响应标头:
Connection: close
Status Code 400 Bad Request
我做错了什么?
【问题讨论】:
-
你设置了 mod_websocket 了吗?
-
在最新版本的 apache (2.4.6+) 中存在 wstunnel 模块,我是通过 LoadModule 在我的 .conf 文件中添加的
标签: apache nginx proxy websocket