I have two ec2 instances and they are connected via aws Application load balancer. And my nginx configuration for the socket is as follows:
location ~* \.io {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Now here what happens is , the moment client tries to connect , it gives opcode -1 and disconnects it.
and it also gives me 400 bad reqeust for the url ws://url.com/socket.io/?EIO=3&transport=websocket&sid=3qrukUCAjUPKRBlfAAAn