426 Upgrade Required
The server refuses to perform the request using the current protocol.
Usually happens because:
- ☑ Client requesting WebSocket paths using
- ☑ Server requiring TLS connections but
🔍 Quick Checklist:
Meaning
The HTTP 426 Upgrade Required client error status code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol (e.g. TLS 1.3).
Root Causes
- Client requesting WebSocket paths using legacy HTTP/1.0 connections.
- Server requiring TLS connections but client requested cleartext HTTP.
| Cause | Frequency |
|---|---|
| Client requesting WebSocket paths using | ⭐⭐⭐⭐⭐ |
| Server requiring TLS connections but | ⭐⭐⭐⭐ |
Common Mistakes
- Omitting the 'Upgrade' header field in 426 responses (the header is mandatory to guide the client).
How to Fix
Framework-Specific Examples
Express middleware requiring HTTP/2.
app.use((req, res, next) => {
if (req.httpVersion < '2.0') {
return res.status(426).set('Upgrade', 'HTTP/2.0').set('Connection', 'Upgrade').end();
}
next();
});Server Configuration Examples
Nginx upgrade header configurations.
# Handled by upstream proxy rulesPrevention
- Configure reverse proxies to block legacy HTTP/1.0 client connections immediately.
Frequently Asked Questions (FAQ)
Q: What header is mandatory in a 426 response?
The 'Upgrade' header is mandatory. It must specify the protocol(s) the server requires to process the request (e.g. `Upgrade: HTTP/2.0`).
Q: How does 426 differ from 101 Switching Protocols?
426 Upgrade Required is a client *error* indicating the server refuses to compile the request unless the client upgrades first. 101 is an *informational* response indicating the server agrees to switch protocols.
Q: Does a browser upgrade automatically on 426?
No. The browser cannot renegotiate protocols automatically mid-request. The client-side application script must establish a new socket connection.
Q: Is 426 cacheable?
No. The 426 Upgrade Required status code is never cached.