101 Switching Protocols

Informational - Protocol upgrade accepted

HTTP 101 Switching Protocols

What It Means

The HTTP 101 Switching Protocols status code indicates that the server understands and is willing to comply with the client's request to switch protocols. The server will switch to the protocol specified in the Upgrade header.

Common Use Cases

  • WebSocket connections: Upgrading from HTTP to WebSocket for real-time bidirectional communication
  • HTTP/2 upgrade: Switching from HTTP/1.1 to HTTP/2 (less common, usually negotiated via ALPN)
  • TLS upgrade: Upgrading an unencrypted connection to TLS

WebSocket Upgrade Example

# Client request
GET /chat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13

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

# Connection is now WebSocket, not HTTP

Required Headers

Header Purpose
Upgrade Protocol to switch to (e.g., "websocket")
Connection Must be "Upgrade"

Important Notes

  • The connection switches immediately after the 101 response
  • Cannot be used with HTTP/2 (uses different negotiation mechanism)
  • The new protocol takes over the TCP connection entirely
  • Server must include the Upgrade header in the response

Frequently Asked Questions

What is HTTP 101 Switching Protocols?
HTTP 101 Switching Protocols is an informational response indicating the server accepts the client's request to switch protocols. It is most commonly used for WebSocket upgrades, where an HTTP connection is upgraded to a full-duplex WebSocket connection for real-time bidirectional communication.
How does a WebSocket upgrade work?
The client sends an HTTP GET request with 'Upgrade: websocket' and 'Connection: Upgrade' headers, along with a Sec-WebSocket-Key. The server responds with 101 Switching Protocols and a Sec-WebSocket-Accept header. After this handshake, the TCP connection switches from HTTP to the WebSocket protocol.
Can HTTP/2 use 101 Switching Protocols?
No. HTTP/2 does not support the 101 Switching Protocols mechanism. Protocol negotiation in HTTP/2 is handled differently, using ALPN (Application-Layer Protocol Negotiation) during the TLS handshake. WebSocket over HTTP/2 uses a different extension mechanism defined in RFC 8441.
What happens after the protocol switch?
Once the server sends the 101 response, the underlying TCP connection is no longer HTTP. The new protocol (usually WebSocket) takes over entirely. No further HTTP requests or responses can be sent on that connection. The connection stays open for bidirectional communication until either side closes it.
How do I monitor WebSocket endpoints?
Standard HTTP monitoring tools check the initial upgrade handshake to ensure the server responds with 101. For deeper monitoring, you need WebSocket-specific tools that establish connections, send test messages, and verify responses. UptimeSignal checks that your endpoints respond with the expected status codes.

Monitor your WebSocket endpoints

UptimeSignal checks your API endpoints and alerts you when they fail.

Start monitoring free →

Related Status Codes

More Resources