0

I am able to receive socket emitted messages properly but I am still receiving this handshake error whenever the pages is loaded at the start.

WebSocket connection to 'ws://example.com/socket.io/?EIO=3&transport=websocket&sid=SBznqHMs6-4SHOdSAAAq' failed: Connection closed before receiving a handshake response

I am using nginx proxy to direct the traffic to several node.js apps. These are my nginx configuration.

upstream app1 {
    ip_hash;
    server 127.0.0.1:3004;
}

server {
    listen 0.0.0.0:80;

    server_name example.com;

    location / {
        proxy_pass http://app1;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-NginX-Proxy true;
        proxy_cache_bypass $http_upgrade;
    }

}

Although the socket works fine but this handshake error is bothering me. Hope anyone who came across this error can shed light on me :)

Shawn Ang
  • 538
  • 7
  • 21

1 Answers1

0

Have you google your issue?, maybe that helps https://github.com/Automattic/socket.io/issues/2045 Socket.io closed before receiving a handshake response [ECONNRESET] after a proxy

Community
  • 1
  • 1
paul
  • 12,873
  • 23
  • 91
  • 153