
Note that when a Status 101 is returned the server must generate an Upgrade header in its response indicating which protocol it has switched to. Also note that the server should only accept switching protocols (and thus return Status 101) when it's advantageous to do so, such as when it upgrades to a newer version of HTTP.
HTTP 101 Switching Protocols is an informational response indicating that the client requested a protocol change and the server has agreed to it. It belongs to the 1xx class of status codes, which are purely informational and do not represent a completed request or an error.
A server returns 101 when a client sends an HTTP request with an Upgrade header specifying a different protocol — most commonly to initiate a WebSocket connection or to switch to a newer HTTP version. The server must include its own Upgrade header in the 101 response to confirm which protocol it has switched to.
Once the 101 response is sent, the original HTTP connection is replaced by the newly negotiated protocol. All further communication between client and server happens over that protocol — for example, the WebSocket frame format instead of standard HTTP framing. The 101 response itself has no body.
No. HTTP 101 is not an error. It is an informational status code in the 1xx range, signaling a successful protocol negotiation between client and server. Errors in HTTP are indicated by 4xx (client errors) and 5xx (server errors) codes.
A 101 response confirms the server accepted the upgrade and switched protocols, allowing WebSocket communication to begin. A 200 response means the server ignored the Upgrade header and handled the request as a normal HTTP request, so the protocol switch did not occur.
No. The server decides whether to accept or ignore the upgrade request. The protocol switch is only advantageous — and therefore only performed — when it benefits the handling of the request, such as enabling a persistent WebSocket connection. If the server does not wish to switch, it can respond with a different status code and continue over the existing protocol.