I'm trying to deploy node.js application with sock.js on EB. Websockets work fine without proxy. When using nginx proxy ws connection issue occured. I have apended .ebextensions/.config file:
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 don't work, but nginx error log says:
upstream prematurely closed connection while reading upstream, client: 83.219.138.215, server: , request: "POST x/XXXXX/432/2l4e2j6v/xhr_streaming HTTP/1.1", upstream: "http://xxx.0.0.1:8081/XXXXX/432/2l4e2j6v/xhr_streaming", host: "XXXXXX.elasticbeanstalk.com", referrer: "http://XXXXXX.elasticbeanstalk.com/"