【发布时间】:2015-01-09 02:24:08
【问题描述】:
我正在尝试在 EB 上部署带有 sock.js 的 node.js 应用程序。 Websockets 在没有代理的情况下工作正常。使用 nginx 代理 ws 时出现连接问题。我附加了 .ebextensions/.config 文件:
files:
"/etc/nginx/conf.d/wssproxy.conf":
mode: "000644"
owner: root
content: |
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Websockets 不工作,但 nginx 错误日志显示:
上游在读取上游时过早关闭连接,客户端:83.219.138.215,服务器:,请求:“POST x/XXXXX/432/2l4e2j6v/xhr_streaming HTTP/1.1”,上游:“http://xxx.0.0.1:8081/XXXXX/432/2l4e2j6v/xhr_streaming”,主机:“XXXXXX.elasticbeanstalk。 com", 推荐人: "http://XXXXXX.elasticbeanstalk.com/"【问题讨论】:
-
想知道你设法让它工作。我有类似的问题stackoverflow.com/questions/27084124/…
标签: node.js nginx websocket amazon-elastic-beanstalk sockjs