
When Cloudflare sits between your visitors and your server, Cloudflare-specific error codes tell you exactly where the failure occurred. The 521, 522, and 524 errors all indicate a problem with your origin server — not with Cloudflare itself — but each identifies a different type of failure.
Understanding which one you're seeing tells you exactly where to look.
| Error | Meaning | Where to look |
|---|---|---|
| 521 | Web server is down / not listening on port 80 or 443 | Web server process (Nginx/Apache) |
| 522 | Connection timed out — Cloudflare connected but origin didn't respond | Server overload, firewall, slow app |
| 524 | A timeout occurred — origin accepted connection but took too long | Long-running request, database query |
A 521 means Cloudflare tried to connect to your origin server and the connection was refused. Your server is reachable at the IP level, but nothing is listening on port 80 or 443.
What to check:
# Is Nginx running?
systemctl status nginx
# Is Apache running?
systemctl status apache2
# Is anything listening on port 80/443?
ss -tlnp | grep -E ':80|:443'
Common causes:
Fix: Restart your web server. If it fails to restart, check the error log:
journalctl -u nginx -n 50
# or
journalctl -u apache2 -n 50
A 522 means Cloudflare opened a TCP connection to your origin but the server never sent a response within the timeout period (usually 15 seconds for the initial connection).
What to check:
# Is the server under high load?
uptime
top
# Are there too many open connections?
ss -s
# Is port 80/443 accessible directly (bypassing Cloudflare)?
curl -I http://YOUR_ORIGIN_IP --header "Host: yourdomain.com" --max-time 10
Common causes:
Fix: Identify and address the resource bottleneck. If it's recurring under load, you need scaling, query optimisation, or connection pooling.
A 524 means Cloudflare successfully connected to your origin and the origin accepted the request, but the response took too long. Cloudflare's default timeout is 100 seconds for most plans.
This is different from 522: the server responded, processed the request, and took too long — rather than not responding at all.
Common causes:
Fix options:
The key thing 521, 522, and 524 have in common: Cloudflare is working correctly. These errors are Cloudflare telling you what your origin server is doing wrong. Resolving them requires fixing the origin.
If you're unsure whether the error is genuinely affecting users or is an isolated blip, checking your uptime monitor's logs will tell you — it connects from multiple locations and records every failure with timestamps.
Domain Monitor monitors your origin health alongside your main URL. When a 521, 522, or 524 occurs, you'll know immediately — not when your first support ticket arrives. Create a free account.
When your site goes down, your status page becomes the most important page you have. Here's why it matters, what happens when you don't have one, and what a good status page does during a real outage.
Read moreYour domain is resolving, but pointing to the wrong server — showing old content, a previous host's page, or someone else's site entirely. Here's what causes this and how to diagnose it.
Read moreUptime monitoring isn't foolproof. Single-location monitors, wrong health check endpoints, long check intervals, and false positives can all cause real downtime to go undetected. Here's what to watch out for.
Read moreLooking to monitor your website and domains? Join our platform and start today.