A 502 Bad Gateway error originating from Cloudflare appears

Hi there,

The first thing that needs to be determined here, is the 502 coming from your origin server or from Cloudflare. We talk about how you can identify this here - Troubleshooting Cloudflare 5XX errors · Cloudflare Support docs

If it is a simple html unbranded 502 error page that shows a white screen, with 502 - bad gateway cloudflare on it, then that is likely coming from our edge indicating a problem.

If it is a branded 502 Cloudflare error page with styled graphics then it is likely coming from your origin.

If you have access to curl at the command line you can run a command like

curl -svo /dev/null https://example.com --connect-to ::<origin_ip>

replacing <origin_ip> with the IP address of your web server. This will allow you to bypass Cloudflare (assuming your firewall allows it) and make a request directly to your origin and see what your origin is returning.

If it is your origin that is returning this, you would need to look at your error logs on your web server to understand what could be happening here and where the failure is being introduced. If its important to get your site back up and running, look at rolling back the changes you did to see if that helps.

Hope this helps!

1 Like