DevToolPal
EN
1xx Informational

101 Switching Protocols

What it means

The server agrees to switch to the protocol the client asked for in the Upgrade header, most often WebSocket. After this response the connection speaks the new protocol.

Common causes

  • A WebSocket handshake succeeded
  • The client requested an h2c (cleartext HTTP/2) upgrade
  • A custom protocol upgrade was accepted

How to fix it

As a client or visitor

101 means success for WebSocket. If you expected 101 but got 200 or 400, check that the URL points to the WebSocket endpoint and that proxies forward the Upgrade and Connection headers.

As the site or API owner

Behind nginx or a load balancer, pass Upgrade and Connection explicitly (proxy_set_header Upgrade $http_upgrade; Connection "upgrade") and raise idle timeouts for long-lived sockets.

Example response

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

Specification

RFC 9110 §15.2.2

FAQ

› Why does my WebSocket return 400 instead of 101?

The handshake headers were missing or altered, often by a proxy that strips Upgrade/Connection, or the Sec-WebSocket-Key or version is invalid.

› Does HTTP/2 use 101?

Only for the rare cleartext h2c upgrade. Browsers negotiate HTTP/2 through TLS ALPN, and HTTP/2 itself has no 101 response.