426 Upgrade Required: what it means and how to fix it
A 426 means the server refuses the request on the current protocol and names the one it wants in the Upgrade header. Common with WebSockets behind a proxy.
· 6 min read · By the Spot Downtime team
A 426 Upgrade Required is one of the rarer status codes. It tells the client that the server won't handle this request over the protocol in use, and that it would do so if the client switched to another one. The response must include an Upgrade header naming the protocol, and a Connection: Upgrade header to go with it.
In practice you will almost always meet it in one place: a WebSocket endpoint that received an ordinary HTTP request. This post covers what the code means, why it shows up behind proxies, and how to fix and monitor it.
What the response looks like
HTTP/1.1 426 Upgrade Required
Connection: Upgrade
Upgrade: websocket
Content-Type: text/plain
Upgrade requiredThe meaning is "ask again, but switch protocols first". For a WebSocket, the client does that by sending a normal GET with Connection: Upgrade and Upgrade: websocket, and the server answers 101 Switching Protocols. If the request arrives without those headers, some servers and libraries reply with 426 instead of a generic 400.
Common causes
- Opening a WebSocket URL in a browser or with curl. A plain GET to a
/wsor/socketpath is not a WebSocket handshake. A 426 here is the endpoint working as designed. - A reverse proxy that drops the upgrade headers. The browser sends the handshake correctly, but nginx, a load balancer or a CDN rule forwards a plain request to the backend. The backend sees no upgrade, so it answers 426 (or 400).
- The client speaks a protocol the server no longer allows. This was the intent in the original design: a server that requires a newer HTTP version or TLS and says so. It is uncommon today, because servers normally negotiate TLS and HTTP/2 during the handshake and fail the connection there instead.
- Wrong URL scheme. Using
http://orhttps://where the library expectsws://orwss://, or pointing a WebSocket client at a REST route that has the same path.
Diagnose it with curl
Send the handshake by hand and look at the status line. A working endpoint returns 101. The key below is only a sample value; any base64 of 16 bytes is accepted.
curl -i -N \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" \
-H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
https://example.com/ws- 101 from the backend directly, 426 or 400 through the proxy: the proxy is stripping the headers. Fix the proxy.
- 426 even directly: the application is rejecting the handshake. Check the path, the origin check and the
Sec-WebSocket-Versionit supports. - 200 with HTML: the request never reached the WebSocket handler. A catch-all route or a CDN is answering first.
Fix it in nginx
Hop-by-hop headers such as Upgrade and Connection are not forwarded by default, and nginx talks HTTP/1.0 to upstreams unless told otherwise. Both must be set for WebSockets:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
location /ws/ {
proxy_pass http://app_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_read_timeout 3600s;
}
}The raised proxy_read_timeout matters too: nginx closes an idle proxied connection after 60 seconds by default, which looks like random WebSocket disconnects. Send a ping frame from the app more often than the timeout, or raise it. See nginx upstream timed out for how to read that error.
426 versus 101, 400 and 501
- 101 Switching Protocols is success: the server agreed and the connection changes protocol.
- 426 says the server would serve the request on a different protocol. The fix is on the client or the proxy in front of the server.
- 400 is what many servers send for a malformed handshake, so the same fault can show as 400 or 426 depending on the library.
- 501 means the server doesn't support the requested functionality at all.
Other layers that can break the upgrade
- Load balancers. Application load balancers support WebSockets, but a classic or misconfigured listener may not. Check the protocol of the listener and target group, and the idle timeout. See ALB 502, 503 and 504 errors.
- CDNs. WebSocket support is often a setting you must enable per zone or domain. If it is off, the CDN forwards a plain request.
- Old HTTP proxies and corporate gateways. Some strip upgrade headers. Using
wss://(TLS) usually gets the connection through, because the proxy then cannot read the headers.
Monitoring a WebSocket service
An HTTP monitor that requests a WebSocket path will see a 426 or 400 on every check, even when the service is healthy. Don't point it at the socket route. Instead, watch an ordinary health route on the same app, which tells you the process and the proxy are up, and add a TCP port check on the listening port. The handshake itself is best covered by a synthetic test or a client heartbeat in your own code.
The HTTP header checkerHTTP header checker shows exactly which Upgrade and Connection headers an endpoint returns, and the 426 status code page has the short reference.
Quick checklist
proxy_http_version 1.1 and the Upgrade and Connection headers, and check CDN and load balancer WebSocket settings. If a human opened the URL in a browser, a 426 is the expected answer.Related reading
Get new guides by email
Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.
Keep reading
- HTTP errors · HTTP · Troubleshooting304 Not Modified: what it means and how conditional requests workA 304 is not an error: it means the cached copy is still good. How ETag and Last-Modified revalidation works, why a 304 can go wrong, and how to debug stale content.November 26, 2026 · 7 min read
- HTTP errors · TroubleshootingRandom 502 errors behind a load balancer: the keep-alive timeout mismatchRare, unpredictable 502s with a healthy backend often come from keep-alive timeouts: the app closes idle connections before the proxy does. How to confirm and fix it.November 26, 2026 · 6 min read