A 502 Bad Gateway error occurs when Cloudflare is unable to establish contact with your origin web server. There are two possible causes:
- 502/504 from your origin web server: Cloudflare returns a Cloudflare-branded HTTP 502 or 504 error when your origin web server responds with a standard HTTP 502 bad gateway or 504 gateway timeout error. This can be caused by a variety of factors, such as:
- Excessive server loads
- Crashes or network failures
- Applications or services that timed out or were blocked
- 502/504 from Cloudflare: In rare cases, Cloudflare itself may experience a temporary outage or issue that can cause a 502 error. If you believe this is the case, you can check the Cloudflare status page to see if there are any known issues.