HTTP Status Codes

101 Switching Protocols

Confirms a protocol upgrade requested via the Upgrade header — the response that completes a WebSocket handshake over an existing HTTP connection.

What it means

A client asks to change protocol with Upgrade and Connection: Upgrade. If the server agrees, it returns 101 Switching Protocols; after that response the same TCP connection speaks the new protocol. The dominant use is the WebSocket opening handshake.

WEBSOCKET HANDSHAKE
> GET /ws HTTP/1.1
> Upgrade: websocket
> Connection: Upgrade
> Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==

< HTTP/1.1 101 Switching Protocols
< Upgrade: websocket
< Connection: Upgrade
< Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

Why it matters

  • It is the bridge from HTTP to WebSocket, letting real-time apps reuse port 443 and existing TLS.
  • HTTP/2 and HTTP/3 use a different mechanism (the CONNECT/:protocol extension) — a raw 101 is an HTTP/1.1 concept.

Common mistakes

  • Reverse proxies that strip the Upgrade/Connection headers, breaking WebSocket connections that then hang or fall back to polling.
  • Expecting 101 over HTTP/2 — it does not apply there.

How WebInspect checks this

  • WebInspect detects WebSocket endpoints in the API Inspector and reports the handshake, subprotocol and negotiated extensions.