101 Switching Protocols
- Meaning
- Server agreed; the connection now uses the new protocol
HTTP 101 Switching Protocols is a success signal: the server agreed to change protocol, usually to WebSocket. How the handshake works and how to proxy it.
HTTP 101 Switching Protocols is not an error. It means the server accepted the client's Upgrade request and is moving the connection to another protocol, most often WebSocket. The server must name the new protocol in an Upgrade header. If a WebSocket fails to connect, the cause is usually that no 101 came back.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
The client asks and the server answers, so 101 comes from the origin server or from a proxy that tunnels the connection. After the response, the same TCP connection carries the new protocol, such as WebSocket. A server "MUST NOT switch to a protocol that was not indicated by the client in the corresponding request's Upgrade header field" and "MAY ignore a received Upgrade header field" and keep using HTTP, which usually means a normal 200 or similar instead of 101.
location /chat/ {
proxy_pass http://backend;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}GET /notifications HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: UpgradeThe client must send Upgrade: websocket and Connection: Upgrade. RFC 9110 says a sender of Upgrade must also send an Upgrade connection option in the Connection header field.
A valid 101 carries Upgrade and Connection headers. If you get 200 or 400 instead, the server (or a proxy) did not accept the handshake.
Upgrade and Connection are hop-by-hop, so nginx's documentation says they "have to be passed explicitly". Without that, the backend never sees the request to switch.
nginx closes a proxied WebSocket connection by default "if the proxied server does not transmit any data within 60 seconds". Increase proxy_read_timeout or send periodic ping frames.
The Upgrade mechanism is for transitioning from HTTP/1.1; test the handshake with a client that uses it before debugging the backend.
4 questions people ask next, answered from the sources on this page.
It is the server's reply to the WebSocket handshake. It confirms the switch from HTTP to WebSocket and includes Upgrade: websocket.
No. It is an informational response that signals success. Errors in a WebSocket connection show up as a different final status.
nginx does not pass Upgrade and Connection to the backend by default, because they are hop-by-hop headers. Set both explicitly with proxy_set_header.
Yes. RFC 9110 says a server MAY ignore it and continue using the current protocol.
Run the free audit, then approve the fixes. Every change can be undone.