HTTP 426 Upgrade Required vs 502 Bad Gateway
HTTP 426 (Upgrade Required) is a 4xx Client Error response, while 502 (Bad Gateway) is a 5xx Server Error response. 426 indicates that the server refuses to perform the request using the current protocol but might after the client upgrades to a different protocol. In contrast, 502 means that the server, acting as a gateway or proxy, received an invalid response from the upstream server.
Description
The server refuses to perform the request using the current protocol but might after the client upgrades to a different protocol.
When You See It
When a server requires HTTPS or a newer protocol version.
How to Fix
Switch to the protocol specified in the Upgrade response header.
Description
The server, acting as a gateway or proxy, received an invalid response from the upstream server.
When You See It
When Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).
How to Fix
Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts.
Key Differences
426 is a 4xx Client Error response, while 502 is a 5xx Server Error response.
HTTP 426: The server refuses to perform the request using the current protocol but might after the client upgrades to a different protocol.
HTTP 502: The server, acting as a gateway or proxy, received an invalid response from the upstream server.
You encounter 426 when when a server requires HTTPS or a newer protocol version.
You encounter 502 when when Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).
When to Use Which
For 426 (Upgrade Required): Switch to the protocol specified in the Upgrade response header. For 502 (Bad Gateway): Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts.