101 Switching Protocols

The server agrees to change protocols on this connection — in practice, almost always upgrading HTTP to WebSocket in response to an Upgrade: websocket request. After a 101, the TCP connection stops speaking HTTP entirely.

What usually causes it

  • A successful WebSocket handshake (Upgrade + Connection: Upgrade headers accepted)
  • HTTP/2 cleartext (h2c) upgrades in server-to-server setups

How to debug and fix it

  1. A 101 is success. If your WebSocket then fails, look at what happens after the upgrade, not the handshake.
  2. If you expected 101 but got 200, an intermediate proxy stripped the Upgrade header — configure it to pass WebSocket traffic (nginx: proxy_set_header Upgrade/Connection).
  3. If you got 4xx instead, check authentication and the exact path — WebSocket endpoints often live on separate routes.

Easily confused with