Switching Protocols
Informational (1xx)The 101 Switching Protocols status code indicates that the server accepts the client's request to switch to a different protocol. The most common use is upgrading from HTTP/1.1 to WebSocket connections. The server includes an Upgrade header in the response specifying the new protocol. After this response, both client and server communicate using the new protocol.
What is HTTP 101 Switching Protocols?
HTTP 101 Switching Protocols is a informational (1xx) status code. The 101 Switching Protocols status code indicates that the server accepts the client's request to switch to a different protocol. The most common use is upgrading from HTTP/1.1 to WebSocket connections. The server includes an Upgrade header in the response specifying the new protocol. After this response, both client and server communicate using the new protocol. Common causes include websocket connection upgrade and http/2 upgrade from http/1.1. This response indicates the server processed the request as expected.
Example Response
HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade
Common Causes
- • WebSocket connection upgrade
- • HTTP/2 upgrade from HTTP/1.1
- • Custom protocol negotiation
What to Know
- 1. This is not an error — it indicates a successful protocol switch
- 2. If WebSocket connections fail after this, check your proxy configuration
- 3. Ensure your load balancer supports WebSocket upgrades
Frequently Asked Questions
When does 101 occur in practice?
The most common case is when a web application establishes a WebSocket connection. The client sends an HTTP request with Upgrade: websocket, and the server responds with 101 to switch from HTTP to the WebSocket protocol.
Can a proxy block 101 responses?
Yes. Some proxies and load balancers do not support protocol upgrades. If WebSocket connections fail, check that your reverse proxy (nginx, Apache, etc.) is configured to pass Upgrade and Connection headers through.
Is 101 used for HTTP/2?
HTTP/2 can be negotiated via the 101 Upgrade mechanism, but in practice most HTTP/2 connections use ALPN (Application-Layer Protocol Negotiation) during the TLS handshake instead.