More
More
101 Switching Protocols
The server agrees to change protocol on this connection, as the client asked in its Upgrade header.
- Code
101- Reason phrase
- Switching Protocols
- Class
- 1xx Informational
- Defined in
- RFC 9110 section 15.2.2
- Cacheable by default
- No
What it means
An interim response: the server sends it before the final one, and the client keeps waiting.
When a server should send it. Only in reply to a request with an Upgrade header naming a protocol the server will switch to, such as websocket. The response must carry Upgrade and Connection: Upgrade, and the new protocol starts straight after the blank line.
Common causes. Opening a WebSocket, or upgrading a connection to HTTP/2 over plain text.
What to do. Nothing when it works. If WebSockets fail behind a proxy, make sure the proxy passes the Upgrade and Connection headers.
How clients and crawlers treat it
Browsers and HTTP clients. Browsers see it when a WebSocket opens over HTTP/1.1. HTTP/2 has no Upgrade mechanism, so WebSockets over HTTP/2 use the extended CONNECT method (RFC 8441) and get a 200 instead.
Google Search. An interim response has no effect on indexing; Google acts on the final status that follows it. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Never cached: an interim response is not a final answer to the request.
Example response
HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= (the connection now speaks the new protocol)
Applications almost never send a 1xx response by hand: the web server or HTTP library produces it as part of the protocol.
Related codes
- 426Upgrade RequiredThe server will only answer over a different protocol, named in the Upgrade header.
- 200OKThe request succeeded and the response carries the result.
- 100ContinueThe server has received the request headers and the client can go ahead and send the body.
All status codes · All 1xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.