5xx Server Error
HTTP 502 Bad Gateway
A gateway or proxy received an invalid response from the upstream server.
Check a URL's HTTP statusWhat 502 means
Common with CDNs, load balancers, and reverse proxies such as Nginx in front of an application server.
Common causes
- The application server crashed or is restarting.
- The upstream server returned a malformed response.
- Firewall rules block the proxy from reaching the origin.
How to fix it
- Check that the origin server is running and reachable from the proxy.
- Review proxy and origin logs around the time of the error.
- Increase upstream timeouts if the app is slow to start.
How to check a status code
Enter a URL in the HTTP Status Checker to see its status code, every redirect hop, and response time. For redirect-heavy pages, the Website Speed Test shows how much time redirects add.
FAQ
- What does HTTP 502 mean?
- 502 Bad Gateway is a 5xx server error status code. A gateway or proxy received an invalid response from the upstream server.
- What causes a 502 error?
- The application server crashed or is restarting. The upstream server returned a malformed response. Firewall rules block the proxy from reaching the origin.
- How do I fix HTTP 502?
- Check that the origin server is running and reachable from the proxy. Review proxy and origin logs around the time of the error. Increase upstream timeouts if the app is slow to start.
Defined in RFC 9110.