The HTTP 101 status code stands for "Switching Protocols". It is an informational response indicating that the server is switching to a different protocol as requested by the client.

When is HTTP 101 Used?

  • When a client sends an Upgrade header in its request, asking to switch to a new protocol.
  • The server acknowledges the request and confirms the protocol switch with a 101 Switching Protocols response.

Common Use Cases

  • WebSockets – Switching from HTTP to WebSocket communication.
  • HTTP/2 – Upgrading from HTTP/1.1 to HTTP/2 without using TLS.

Example:

Client Request:

    
        GET /chat HTTP/1.1
        Host: example.com
        Upgrade: websocket
        Connection: Upgrade
    

Server Response:

    
        HTTP/1.1 101 Switching Protocols
        Upgrade: websocket
        Connection: Upgrade
    

After this response, the communication protocol changes from HTTP to WebSocket, allowing full-duplex communication.

Summary

HTTP 101 is a temporary response code that confirms the server is switching protocols as requested. It is most commonly used for WebSockets and HTTP/2 upgrades.