HTTP 502 Bad Gateway vs 505 HTTP Version Not Supported
Both HTTP 502 (Bad Gateway) and 505 (HTTP Version Not Supported) belong to the 5xx Server Error category. 502 indicates that the server, acting as a gateway or proxy, received an invalid response from the upstream server. Meanwhile, 505 means that the server does not support the HTTP version used in the request.
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.
Description
The server does not support the HTTP version used in the request.
When You See It
When a client uses an HTTP version the server doesn't support.
How to Fix
Use a supported HTTP version (typically HTTP/1.1 or HTTP/2).
Key Differences
HTTP 502: The server, acting as a gateway or proxy, received an invalid response from the upstream server.
HTTP 505: The server does not support the HTTP version used in the request.
You encounter 502 when when Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).
You encounter 505 when when a client uses an HTTP version the server doesn't support.
When to Use Which
For 502 (Bad Gateway): Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts. For 505 (HTTP Version Not Supported): Use a supported HTTP version (typically HTTP/1.1 or HTTP/2).