HTTP 101 Switching Protocols indicates the server understands and agrees to the client's request to change the application protocol via the Upgrade header. This is commonly seen during WebSocket handshakes where the connection upgrades from HTTP to the WebSocket protocol.
101 Switching ProtocolsGET /live-chat HTTP/1.1
Host: www.example.com
User-Agent: curl/8.6.0
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==
Sec-WebSocket-Version: 13HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
<connection is now a WebSocket — messages flow both ways>If upgrading to WebSocket, confirm the server responds with Upgrade: websocket and Connection: Upgrade headers.
curl -v -H 'Upgrade: websocket' -H 'Connection: Upgrade' -H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' -H 'Sec-WebSocket-Version: 13' https://example.com/ws
Ensure any reverse proxy (Nginx, Cloudflare) supports WebSocket pass-through. Proxies that do not forward Upgrade headers will break the handshake.
The client requested a WebSocket connection via the Upgrade: websocket header and the server accepted the protocol switch.
The client requested an upgrade to HTTP/2 using the Upgrade header in an HTTP/1.1 request.
| Specification | Section |
|---|---|
| HTTP Semantics | RFC 9110 §15.2.2 |
This reference was compiled from official RFCs, protocol specifications, and hands-on troubleshooting experience. AI tools were used primarily for formatting and organizing the content on the page.