HTTP status code 502 Bad Gateway
HTTP 502 Bad Gateway is the status code a proxy, load balancer or CDN returns when the upstream server behind it refused the connection or sent a response it could not use.
Fixing this error on a site, a server or an API? Step-by-step guide: HTTP 502 Bad Gateway: What It Means and How to Fix →
Definition (RFC 9110)
HTTP status code 502 Bad Gateway is defined in RFC 9110 (HTTP Semantics), Section 15.6.3 — the current authoritative specification for HTTP semantics, published June 2022, which obsoletes the older RFC 7231 and RFC 2616.
Description
The 502 Bad Gateway status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
Common Causes
- Upstream server is down
- PHP-FPM/application process crashed
- Timeout from upstream server
- Firewall blocking upstream connection
- DNS resolution failure for upstream
How to Fix
- Check upstream server status
- Restart PHP-FPM or application process
- Increase proxy timeout values
- Check nginx/Apache proxy configuration
- Verify upstream server health
Check your website's HTTP status code
Check now →