tool::http-status-detail
502 Bad Gateway
The gateway received an invalid response from an upstream server.
Status Code
502
Name
Bad Gateway
Category
5xxDetailed Explanation
HTTP 502 Bad Gateway indicates that a gateway or proxy server received an invalid response from an upstream server. This typically occurs when the application server behind a reverse proxy (Nginx, AWS ALB, etc.) is down or sending malformed responses. It can also occur with CDNs when there are origin server issues.
Common Causes
- ▸The upstream application server is down
- ▸The upstream server returned a malformed response
- ▸All servers behind the load balancer are unhealthy
- ▸Network issues between the proxy and upstream server
- ▸The upstream server is rejecting connections due to overload
How to Fix
- 1.Check that the upstream server process is running (systemctl status, docker ps)
- 2.Verify the upstream address and port in the proxy configuration
- 3.Check the upstream server logs
- 4.Test network connectivity between servers (curl, telnet)
- 5.Increase the proxy timeout settings (e.g., proxy_read_timeout)
Related HTTP Headers
Retry-AfterServerResponse Example
HTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 Content-Type: text/html <html><body><h1>502 Bad Gateway</h1></body></html>
Related Status Codes
500Internal Server ErrorThe server encountered an unexpected condition.→501Not ImplementedThe server does not support the requested functionality.→503Service UnavailableThe server is temporarily unable to handle the request.→504Gateway TimeoutThe gateway did not receive a timely response from an upstream server.→505HTTP Version Not SupportedThe HTTP version used in the request is not supported.→
ad · 300×250
// related tools