# Socket Error

# Server Hosting Error

If you see socket connection error to 'wss://sub.domain.com/' failed:

Websocket console error
Websocket console error

# Resolution

If we are using NGINX reverse proxy for serving or hosting traffic, the error can be fixed by setting Upgrade header to $http_upgrade and Connection to "upgrade"

# Code-Solution

server {
    listen <external-web-port>;
    server_name relevant-domain-from-error.com;
   
    location / {
	proxy_pass <hosted-serving-url-with-port>;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
        ...
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}