What it means: Cloudflare reached your origin's IP, but the server refused the connection.
Free online tool — HTTP status code checker: instant results, no signup.
Requests the address and shows the status code and what the server sends back.
Cloudflare's documentation defines it plainly: "Error 521 occurs when the origin web server refuses connections from Cloudflare" (Cloudflare: Error 521). The visitor sees Cloudflare's "Web server is down" page with a Ray ID, and the HTTP status is 521. Cloudflare itself works; the hop from Cloudflare to your server does not.
"Refuses" is precise: the origin host is reachable on the network and answers the TCP connection attempt with a rejection (a TCP RST, usually because nothing listens on the port, or a firewall rule rejects it). Compare the neighbours:
| Cause | How to recognise it | Fix |
|---|---|---|
| Web server stopped or crashed | systemctl status nginx (or apache2, caddy) not active; nothing in ss -ltn on 80/443 | Start it, then find why it stopped in its error log |
| Firewall or security tool blocks Cloudflare | The site loads when you connect to the origin from your own IP, but Cloudflare gets 521; fail2ban or a host firewall lists Cloudflare addresses | Allow every range from cloudflare.com/ips |
| SSL/TLS mode and port disagree | Full or Full (strict) set, but the server has no HTTPS listener; or Flexible set and port 80 closed | Port 443 for Full and Full (strict), port 80 for Flexible, as Cloudflare's docs require |
| Wrong origin address in DNS | The proxied A or AAAA record points to an old or different server | Correct the record in the Cloudflare DNS tab |
| AAAA record without an IPv6 listener | The server listens on IPv4 only, but the zone has an AAAA record for the origin | Listen on IPv6 (listen [::]:443) or remove the AAAA record |
The firewall case has a classic trigger. All proxied traffic arrives from Cloudflare addresses, so a brute-force detector that reads raw connection IPs sees one "client" making thousands of requests and bans it. Configure the web server to log the visitor IP from the CF-Connecting-IP header (nginx: set_real_ip_from for each Cloudflare range plus real_ip_header CF-Connecting-IP;) so bans hit attackers, not Cloudflare.
curl -sv --resolve example.com:443:203.0.113.10 https://example.com/ -o /dev/null
# * connect to 203.0.113.10 port 443 failed: Connection refused "Connection refused" reproduces 521. Repeat on port 80 with http:// if you use Flexible.ss -ltnp | grep -E ':(80|443) '
systemctl status nginx --no-pageriptables -S | grep -E 'DROP|REJECT'
nft list ruleset | grep -iE 'drop|reject'
fail2ban-client status Compare banned addresses with curl -s https://www.cloudflare.com/ips-v4 and curl -s https://www.cloudflare.com/ips-v6.A 521 page is about the website's own server, so nothing on your device causes it or fixes it: clearing the cache, changing DNS or switching browsers will not help. The page tells you which part failed. The browser-to-Cloudflare leg is marked as working, the "Host" box shows the error, and the Ray ID at the bottom identifies your request in Cloudflare's logs. If you can reach the site owner, send them that Ray ID and the time you saw the error. Then wait and retry: a 521 caused by a restart or a deploy often clears within minutes, while one caused by a firewall rule lasts until the owner changes it.
curl -s -o /dev/null -w '%{http_code}\n' --resolve example.com:443:203.0.113.10 https://example.com/
# 200
curl -sI https://example.com/ | grep -iE '^(HTTP|server|cf-ray)'
# HTTP/2 200
# server: cloudflareThe first command proves the origin accepts connections; the second, that the proxied site works end to end. Error Analytics in the dashboard (filter by edge status code 521) should drop to zero. The HTTP status checker shows the status your public URL returns from outside your network.
HTTP status codes are three-digit numbers that the server returns for every request. They tell the browser and search crawlers what happened: success, redirect, or error.
Enter a code or keyword — instant result with description.
1xx Informational, 2xx Success, 3xx Redirect, 4xx Client Error, 5xx Server Error.
For each code: typical causes and concrete steps to resolve.
How each code affects indexing and link juice transfer in Google.
choosing correct status
redirect optimization
5xx error diagnostics
landing page check
HTTP monitor alerts when response code changes or 5xx appears.
Sign up freeNo. Cloudflare reached your server and the server refused the connection, so the fault is at the origin: a stopped web server, a firewall or a wrong port.
Your own IP is allowed and Cloudflare's are not, or Cloudflare connects on a different port than you test. Allow all Cloudflare IP ranges and check the SSL/TLS mode port.
Port 80 in Flexible mode and port 443 in Full and Full (strict), according to Cloudflare's 521 documentation. The origin must listen on the port your mode uses.
521 means the origin actively refused the connection. 522 means the origin did not answer the connection attempt at all before Cloudflare timed out.
Yes. If it sees Cloudflare addresses instead of visitor IPs, it can ban them. Restore real visitor IPs from the CF-Connecting-IP header and whitelist Cloudflare ranges.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.