Reference

Cloudflare Error 521: Web Server Is Down, what it means and how to fix it

6 min read · Published Jul 17, 2026
Contents · 7 sections
  1. What 521 actually says
  2. 521 vs 520 vs 522 at a glance
  3. Four common causes of 521
  4. Why the owner sometimes sees the site working fine
  5. Owner checklist, in order
  6. What visitors can do
  7. FAQ

Cloudflare Error 521, "Web Server Is Down", means Cloudflare's edge reached out to your origin server and the origin actively refused the TCP connection. Not a timeout, not a garbled response, a refusal, usually a TCP RST packet, because nothing is listening on the port Cloudflare dialed or a firewall is rejecting Cloudflare's address ranges. The visitor's connection to Cloudflare is fine, which is why they see an error page at all. The broken hop is the one between Cloudflare and the server behind it.

What 521 actually says

When a request arrives at Cloudflare's edge for a proxied site, Cloudflare opens its own TCP connection to the origin: it sends a SYN packet to the origin IP on the configured port and waits for a SYN-ACK. Three things can go wrong at this step, and Cloudflare gives each one its own error code:

The refusal in 521 is diagnostically valuable. Silence (522) could be anywhere along the path. A refusal proves packets are reaching a host that is up at the kernel level, so the problem is confined to the port, the listening process, or an explicit firewall rule.

521 vs 520 vs 522 at a glance

CodeWhat Cloudflare sawWhere to look first
520 Unknown ErrorOrigin replied, but the response was not parseable HTTP.Origin application logs, malformed or truncated responses.
521 Web Server Is DownTCP connection actively refused, RST came back fast.Is the process running, is the port open, is Cloudflare allowlisted.
522 Connection Timed OutSYN sent, no SYN-ACK within the window, silence.Silent firewall drops, accept-queue saturation, routing.

Quick mental shortcut: 521 means the origin said no, 522 means the origin said nothing, 520 means the origin said something unintelligible.

Four common causes of 521

Why the owner sometimes sees the site working fine

521 produces a confusing situation: visitors get the error page while the operator swears the site is up. All of these make "works on my machine" true and irrelevant at the same time:

The only test that counts is the one that reproduces Cloudflare's exact path: a connection from an outside network, to the exact IP in the DNS record, on the exact port the SSL mode implies.

Owner checklist, in order

  1. Confirm something is listening. On the origin, run ss -ltn and look for the port Cloudflare connects to, 443 for Full modes, 80 for Flexible. If it is missing, restart the service and read the logs to find out why it died.
  2. Hit the origin directly by IP from an outside network. curl -vk --resolve example.com:443:ORIGIN_IP https://example.com/ from a machine outside your network. "Connection refused" from outside while the same command works locally is the firewall signature. A working response from outside means the refusal only affects Cloudflare's ranges specifically.
  3. Verify the Cloudflare IP allowlist at every layer. Cloud security group, OS firewall, fail2ban, any edge appliance. Cloudflare publishes its ranges at cloudflare.com/ips-v4 and ips-v6, and those lists change occasionally, so a stale allowlist can start failing without anyone touching the config.
  4. Check the DNS record's target. In the Cloudflare dashboard, confirm the origin record points at the server you think it does. After any migration, this is the record most often forgotten.
  5. Match the SSL/TLS mode to what the origin serves. If the origin has no certificate, Full mode will dial a closed 443 forever. The durable fix is to install a certificate at the origin, Cloudflare issues free origin certificates for exactly this, and run Full (strict). Downgrading to Flexible hides the error but leaves the Cloudflare-to-origin leg unencrypted.
  6. Watch the recovery. A monitor on isitdown.io probes the site with 4 independent methods every 5 minutes and opens an incident after 2 consecutive failed rounds, so you will know whether the fix held past the first manual refresh.

What visitors can do

Almost nothing, and that is worth knowing so you stop trying. The refused connection is between Cloudflare and the origin, a layer no browser setting, DNS flush, VPN, or cache clear can touch. Two actions are still useful:

FAQ

Can anything on my computer cause a 521?

No. 521 is generated by Cloudflare after your request already arrived at its edge successfully. Everything client-side, your DNS, your browser, your network, has already done its job by the time the error is produced. It is purely a server-side condition.

How long does a 521 usually last?

It depends on the cause. A crashed process under a supervisor restarts in seconds and the error clears on its own. A firewall rule, a wrong DNS target, or an SSL mode mismatch persists until a human changes the configuration. A 521 that lasts more than a few minutes almost always needs operator action.

Does 521 mean the whole server is offline?

Usually not. A refused connection proves the opposite at the network level: a machine at that address is up and responding to packets. What is down is the specific service on the specific port, or the firewall is rejecting the specific source. A fully offline or unroutable server tends to produce 522 or 523 instead, because nothing answers at all.

Share 𝕏 Twitter LinkedIn
Keep reading

← All notes & guides