101 Switching Protocols
1xx informational
The server agrees to switch the connection to another protocol, most often WebSocket.
101 is the server saying yes to an Upgrade request. The client asks — for example with Upgrade: websocket and Connection: Upgrade — and the server replies 101 with the same Upgrade header. From that moment the TCP connection stops speaking HTTP/1.1 and carries the new protocol instead. Every WebSocket connection over HTTP/1.1 begins this way.
| Class | 1xx Informational |
|---|---|
| Retry? | Not applicable |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | None |
| Defined in | RFC 9110 §15.2.2 — 101 Switching Protocols |
HTTP/1.1 101 Switching Protocols
When you'll see it
- A WebSocket handshake succeeded (
new WebSocket("wss://…")in the browser). - A client requested an HTTP/1.1 to cleartext HTTP/2 (h2c) upgrade — rare, since browsers only use HTTP/2 over TLS.
What to do
- If you expected 101 but got 200 or 400, the server or a proxy in front of it doesn't pass the upgrade through. nginx needs
proxy_http_version 1.1;,proxy_set_header Upgrade $http_upgrade;andproxy_set_header Connection "upgrade";. - A 426 Upgrade Required means the server insists on a protocol you didn't ask for.
- HTTP/2 and HTTP/3 don't use 101; WebSockets over HTTP/2 use extended CONNECT (RFC 8441) instead.
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
Why does my WebSocket work locally but fail behind nginx?
nginx proxies with HTTP/1.0 and drops hop-by-hop headers by default, so the Upgrade request never reaches your app. Add proxy_http_version 1.1 and forward the Upgrade and Connection headers.
Does a 101 response have a body?
No. After the 101 headers, every byte on the connection belongs to the new protocol.