The client must switch to another protocol.
When to use it
Forcing a newer TLS or HTTP version.
Common causes and fixes
426 means the server won’t serve the request over the current protocol and lists the acceptable ones in an Upgrade header. Most often you see it from a WebSocket endpoint opened with a plain HTTP request, in a browser tab or with curl: the server expected Upgrade: websocket. It also happens when a reverse proxy drops the Upgrade and Connection headers on the way to a WebSocket server.
It isn’t the right tool for moving visitors from HTTP to HTTPS: browsers won’t upgrade on their own after a 426, so use a 301 or 308 redirect plus HSTS. Some APIs use 426 to force outdated mobile app versions to update, with a message in the body. If a proxy is at fault, nginx needs proxy_http_version 1.1 and both headers forwarded.
Client error (4xx)
4xx codes are client errors: the request itself is wrong, unauthorised or points at something that isn’t there. Retrying the same request won’t help.
What it looks like
HTTP/1.1 426 Upgrade RequiredHow to send it
| Node.js / Express | res.status(426).end() |
|---|---|
| Python / Flask | return '', 426 |
| nginx | return 426; |
How to check it
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/