Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

WebSocket handshake failed with unexpected response code: 200 — what is wrong?

Illustration without a description Illustration without a description

The browser’s WebSocket upgrade received an ordinary 200 response. Inspect its body and headers. A normal webpage or API response can reveal that the request reached a catch-all handler, or that the proxy forwarded it without the information needed to upgrade.

 

Check the URL and confirm the intended route accepts WebSocket connections. For HTTP/1.1, verify that Upgrade and Connection reach the handler and look for 101 Switching Protocols in the response. Compare the proxied request with the origin when you can test it safely.

 

curl -i –http1.1 https://example.com/ws \ -H 'Connection: Upgrade' -H 'Upgrade: websocket' \ -H 'Sec-WebSocket-Version: 13' \ -H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ=='

 

The curl probe sends an HTTP/1.1 upgrade. If it reaches 101 but the browser still fails, compare the Origin and credentials on the two requests, then check whether the browser reaches its open event.

 

Check the handshake headers on both sides of the proxy and verify that the HTTP/1.1 route returns 101.