Cloudflare sits in front of your website. Visitors connect to Cloudflare, and Cloudflare fetches the page from your own server (called the "origin"). When you see a Cloudflare error page, it's usually Cloudflare telling you it couldn't get a good answer from your server. So the fix is usually on your server or with your host, not in Cloudflare. The error number tells you exactly which step failed.
What's the problem
Visitors see a Cloudflare-branded page with an error number, a "Ray ID", and a diagram showing your browser, Cloudflare and your host, with one of them marked as the problem.
Why it happens
The number is the clue:
- 520: your server sent back something empty or unexpected.
- 521: your server refused the connection: it's down, or blocking Cloudflare.
- 522: your server didn't answer in time: it's overloaded, offline, or a firewall is dropping Cloudflare.
- 523: Cloudflare can't reach your server's address at all, usually a wrong IP in DNS.
- 524: your server accepted the request but took too long to finish it.
- 502 or 504: your server itself returned a bad gateway or timeout error.
- 1000-series errors (1016, 1020 and others) are about Cloudflare settings: DNS, firewall rules or access.
How to fix it
- Note the error number and the Ray ID on the page. See Cloudflare Ray ID.
- Look at the diagram. If it marks "Host" as the error, the problem is your server.
- Check your server is running and reachable at the IP address in your Cloudflare DNS records.
- Check your server isn't blocking Cloudflare. Firewalls and security plugins sometimes block Cloudflare's IP addresses.
- Check Cloudflare's status page to rule out a Cloudflare incident.
- Contact your host with the error number, Ray ID and time, as Cloudflare's own guidance recommends.
What Preventionlabs checks
One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; uptime checked every 5 minutes, with an email when the site goes down and when it is back. With Cloudflare connected, it also shows which pages returned server errors (5xx) to visitors, and when; your SSL mode and the other settings that commonly cause this; which requests the firewall blocked, by Cloudflare's own rule names; recent deploys and account changes, with their times; DNS changes in the last 7 days.
Run your free reportYour first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.
Sources
- Cloudflare: Cloudflare 5xx errorsofficial docs
When troubleshooting most 5XX errors, the correct course of action is to first contact your hosting provider or site administrator to troubleshoot and gather data.
Preventionlabs is independent and not affiliated with Cloudflare. Product names are used only to describe the problem.
← All of Cloudflare errors