WebSocket connection to 'wss://x' failed
The browser couldn’t open (or keep) a WebSocket connection.
Seen on:
JavaScript
Meaning
Proxies that don’t forward the Upgrade header, ws:// from an HTTPS page, wrong paths, and load balancer idle timeouts are typical.
Common causes
- Reverse proxy not forwarding Upgrade/Connection headers
- ws:// used on an HTTPS page (must be wss://)
- Wrong URL/path or server down
- Idle timeout closing the connection
⚡ Quick fix
- Configure proxy upgrade headers
- Use wss:// on HTTPS pages
- Send ping/heartbeats
- Check the server logs for the handshake
Detailed fix by platform
Nginx
- nginx
proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
How to diagnose
- Handshake — Status of the upgrade request (101 expected)?
- Proxy — Upgrade headers forwarded?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026