DevToolsmith

HTTP 101 Switching Protocols

HTTP 101 Switching Protocols means the server agrees to switch to the protocol the client asked for, such as WebSocket. The request was received and processing continues.

Class
1xx Informational
Standard
RFC 9110
Cacheable by default
No
Safe to retry
Not applicable: this isn’t an error
Go constant
http.StatusSwitchingProtocols

What HTTP 101 means

Every WebSocket connection starts as an HTTP/1.1 request with Upgrade: websocket and Connection: Upgrade. A 101 response completes the handshake, and from then on the TCP connection speaks the WebSocket protocol instead of HTTP.

Using 101 correctly

  • Behind nginx, WebSocket upgrades only work if you forward the headers: proxy_set_header Upgrade $http_upgrade; and proxy_set_header Connection "upgrade";.
  • HTTP/2 and HTTP/3 don’t use 101. WebSockets over them use extended CONNECT instead.

Retrying

Not applicable: this isn’t an error.

Example response

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

Related status codes

Other 1xx status codes

100 Continue · 103 Early Hints

See the full list of HTTP status codes.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does HTTP 101 Switching Protocols mean?

HTTP 101 Switching Protocols means the server agrees to switch to the protocol the client asked for, such as WebSocket. Every WebSocket connection starts as an HTTP/1.1 request with Upgrade: websocket and Connection: Upgrade. A 101 response completes the handshake, and from then on the TCP connection speaks the WebSocket protocol instead of HTTP.