~/devtools / http-status / 502
tool::http-status-detail

502 Bad Gateway

The gateway received an invalid response from an upstream server.

ad · 728×90
Status Code
502
Name
Bad Gateway
Category
5xx

Detailed 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-AfterServer

Response 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
Back to all status codes
// related tools
Cron Expression Generator
Build and parse cron expressions visually. Generate human-readable descriptions and preview next execution times.
jwt
JWT Decoder
Decode and inspect JWT tokens. View header, payload, and signature details.
rx
Regex Tester
Test regular expressions with live matching, group highlighting, and explanations.
Color Converter
Convert colors between HEX, RGB, HSL, and more. Pick colors visually.