Skip to the content

101 Switching Protocols

The server agrees to switch this connection to another protocol, as the client asked in its Upgrade header. Every WebSocket starts with it.

Class
1xx Informational. An interim answer: the request has arrived and the final response is still to come.
Defined in
RFC 9110

What it looks like

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

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

When a server sends it

In answer to a request with an Upgrade header, when the server is willing to change. The usual case is a WebSocket: the browser sends a GET with Upgrade: websocket and a random key, the server replies 101 with a matching Sec-WebSocket-Accept header, and from then on the same connection carries WebSocket frames.

What to do with it

For a visitor there is nothing to see. A 101 in the network tab of the browser's developer tools means the WebSocket connected.

If you expected a 101 and got 200, 400 or 426, look at the proxy in between. A reverse proxy has to be told to pass the Upgrade and Connection headers on, and nginx, for one, doesn't do that by default.

HTTP/2 has no 101. A WebSocket over HTTP/2 is set up with a CONNECT request.

Not to be confused with

426 Upgrade RequiredThe other direction: the server demands a protocol the client did not offer.
200 OKWhat you get when the server ignored the Upgrade header and answered over plain HTTP.

All codes are on the list of HTTP status codes, which can be searched by number and by word.

See all 12