In this article
If your site runs through Cloudflare, visitors connect not to your server but to Cloudflare, and Cloudflare then fetches the page from you. When your server doesn’t respond or responds incorrectly, Cloudflare shows its own error page with a code from 520 to 526. It shows three icons — browser, Cloudflare and “Host” — and usually it is Host, i.e. your server, that is highlighted in red.
What it is
| Code | What happened | What to check |
|---|---|---|
| 520 | The server returned an empty or unexpected response | PHP crashes, headers that are too large, web server logs |
| 521 | The server refused the connection | Is nginx/Apache running, is the firewall blocking Cloudflare’s IPs |
| 522 | The server didn’t answer the connection in time | Overload, firewall, is the IP in Cloudflare DNS correct |
| 523 | The server can’t be reached | The IP in the A record in Cloudflare, is the server’s network up |
| 524 | Connected, but the page took longer than 100 seconds | Heavy scripts, imports, reports — move them to the background |
| 525 | Couldn’t establish an encrypted connection to the server | Is there SSL on port 443 on the server, the SSL mode in Cloudflare |
| 526 | The server certificate is invalid (Full strict mode) | Expiry and domain of the server certificate, or the Cloudflare Origin certificate |
How the monitor checks
Impact on the site and business
- The site is unavailable to every visitor, even though “Cloudflare is working”.
- The cache won’t save you: Cloudflare can serve saved pages only if specially configured — by default visitors see the error.
- Confusion when looking for the cause: the owner writes to Cloudflare support, while it is their own server that needs fixing.
Why it matters
A typical case is a 521 after “tightening security”: a firewall was turned on on the server that only lets known IPs through, and Cloudflare’s addresses were forgotten. Another common one is a 526 three months after connecting: the server had a Let's Encrypt certificate without auto-renewal, it expired, and Cloudflare in strict mode stopped connecting to it.
Norms
| Rating | Status | Comment |
|---|---|---|
| Good | No 52x errors | The connection between Cloudflare and the server is fine |
| Could be better | Occasional 524s on individual pages | Some operations take too long |
| Bad | 520–523, 525, 526 on the home page | The site is unavailable |
How to fix it
- Identify the error code — it is in the monitor report or on the Cloudflare page.
- Check the server directly, bypassing Cloudflare: is the web server running, is there enough memory, are there errors in the logs (see Server not responding).
- Make sure the IP in the A record under Cloudflare → DNS is your server’s IP.
- For 525/526, check SSL on the server and the mode under Cloudflare → SSL/TLS.
Server (nginx)
If the server has a firewall (ufw, iptables, fail2ban) or hosting protection, Cloudflare’s addresses must be allowed. The list of official ranges is at cloudflare.com/ips. To check that the web server is listening on port 443:
sudo ss -tlnp | grep -E ":443|:80"
sudo tail -n 50 /var/log/nginx/error.logCloudflare
Under SSL/TLS, “Full (strict)” mode requires a valid certificate on the server. The most reliable option is to issue a free 15-year Cloudflare Origin certificate and install it on the server: then there will be no 526 from an expired certificate. Don’t use “Flexible” mode — it leads to redirect loops and encrypts only half the route.
Hosting and control panel
On shared hosting, 521/522 often mean the host is blocking frequent requests from Cloudflare addresses as an “attack”. Write to support that the site runs through Cloudflare and include the error times from the monitor.
General recommendations
- When you turn on a server firewall, add Cloudflare’s ranges to the allow list straight away.
- Use a Cloudflare Origin certificate so you don’t depend on renewal.
- Run long operations (imports, exports) in the background, not in the browser — otherwise you get 524.
FAQ
Is it a Cloudflare failure or mine?
Look at the error page: if “Host” is highlighted in red, the problem is on your server. Cloudflare’s own outages are shown on cloudflarestatus.com and are rare.
Can I just turn Cloudflare off?
You can (the “Pause Cloudflare” button or a grey cloud on the record), and it helps find where the problem is. But if the server is down, it won’t open without Cloudflare either.
Why does the monitor say “blocked by protection” rather than 503?
Cloudflare showed the bot a “Just a moment…” challenge. The site works for people. For the monitor to see the site, allowlist it — see the “Allowlist the monitor” page.