426 Upgrade Required
4xx client error
The server refuses the request over the current protocol and asks the client to upgrade.
426 means 'not like this — switch protocols first'. The server sends an Upgrade header naming the protocol it requires, such as WebSocket or a newer HTTP version. Unlike 101, which agrees to an upgrade the client asked for, 426 demands one the client didn't ask for.
| Class | 4xx Client Error |
|---|---|
| Retry? | No — change the request first |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | RFC 9110 §15.5.22 — 426 Upgrade Required |
Example response
HTTP/1.1 426 Upgrade Required
Upgrade: websocket
Connection: Upgrade
Content-Type: application/json
Content-Length: 28
{"error":"Upgrade Required"}Common causes
- Calling a WebSocket-only endpoint with a plain HTTP request.
- Servers that require a newer HTTP version or TLS.
How to fix it
- Connect with the protocol named in the
Upgradeheader — for WebSockets,new WebSocket("wss://…"). - Make sure proxies aren't stripping the
Upgradeheader from your request.
Send a 426 from your server
Express
res.set("Upgrade", "websocket");
res.set("Connection", "Upgrade");
res.status(426).json({ error: "Upgrade Required" });Next.js route handler
return Response.json({ error: "Upgrade Required" }, { status: 426, headers: { "Upgrade": "websocket", "Connection": "Upgrade" } });Flask
return {"error": "Upgrade Required"}, 426, {"Upgrade": "websocket", "Connection": "Upgrade"}Go net/http
w.Header().Set("Upgrade", "websocket")
w.Header().Set("Connection", "Upgrade")
http.Error(w, "Upgrade Required", http.StatusUpgradeRequired)nginx
add_header Upgrade "websocket" always; add_header Connection "Upgrade" always; return 426;
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
426 vs 101?
101: the server agrees to switch to the protocol you requested. 426: the server refuses to continue until you switch.
Related status codes