521 Web Server Is Down
Cloudflare tried to open a connection to your origin server and the connection was refused. Either nothing is listening there, or something is rejecting Cloudflare.
What 521 means
A refused connection is an active "no". The machine at the origin address is up and reachable, and it answered Cloudflare's connection attempt by rejecting it. That is different from silence, which Cloudflare reports as 522, and it narrows the search to two possibilities: the web server process is not accepting connections on that port, or a firewall is rejecting Cloudflare's addresses.
The error page says "Web server is down". The server as a machine is usually fine; it is the web server software, or access to it, that is not.
Check, in this order
- Is the web server running? On the origin:
systemctl status nginx(orapache2,httpd, your application's service). A service that failed to restart after a configuration change or a reboot is the commonest cause.nginx -torapachectl configtestshows a configuration error that stops it from starting. - Is it listening on the port Cloudflare uses?
ss -ltnplists listening sockets. Cloudflare connects on port 80 when the zone's SSL/TLS mode is Flexible and on port 443 when it is Full or Full (strict). A server that only listens on 80, behind a zone set to Full, refuses every connection on 443. - Does the origin speak HTTPS? For Full and Full (strict) it needs a certificate installed and a TLS listener. A Cloudflare Origin Certificate is enough for both modes.
- Is something rejecting Cloudflare? Host firewalls (
iptables,ufw),fail2ban, security plugins and hosting-provider firewalls see a lot of traffic from a few Cloudflare addresses and may ban them. Allow Cloudflare's published IP ranges. - Is the DNS record pointing at the right machine? If the origin's address changed, Cloudflare may be knocking on a server that no longer hosts the site.
Confirming from outside
Connect to the origin address yourself, on the port Cloudflare would use:
curl -sv --resolve example.com:443:203.0.113.10 https://example.com/
"Connection refused" from your own machine means the web server is not listening. If it works for you and fails for Cloudflare, a firewall is treating Cloudflare's addresses differently. If you cannot log in to the origin at all, the host itself may be down; an external check shows what the rest of the world sees.
521, 522 and 523 side by side
| Code | What happened to the connection attempt | First suspect |
|---|---|---|
| 521 | Rejected straight away | Web server stopped, wrong port, or a firewall that rejects |
| 522 | No reply until Cloudflare gave up | A firewall that silently drops, or an overloaded host |
| 523 | Could not be routed to the origin at all | Wrong origin IP address or a routing fault |
An nginx proxy in the same position would log Connection refused and answer 502.
Example 521 response
HTTP/2 521
date: Sat, 14 Nov 2026 09:44:52 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
cf-ray: 8e2a20c7b9d41a3e-AMSThe response comes entirely from Cloudflare; the origin contributed nothing. The HTML body (omitted) is the "Web server is down" page with the same Ray ID printed at the bottom.
Documented in Cloudflare docs: Error 521.
Questions
What does error 521 mean?
Cloudflare could not open a connection to the website's origin server because the server refused it. The web server software is stopped, is not listening on the expected port, or is blocking Cloudflare's IP addresses.
How do I fix a 521 error on my site?
Start or restart the web server and confirm it is listening on port 443 (or port 80 if your Cloudflare SSL/TLS mode is Flexible). Then make sure no firewall or security tool on the origin blocks Cloudflare's IP ranges.
Why did 521 start after I changed the SSL mode in Cloudflare?
Flexible mode connects to the origin over HTTP on port 80; Full and Full (strict) connect over HTTPS on port 443. If the origin has no HTTPS listener, switching to Full makes every connection fail. Install a certificate on the origin and enable its port 443 listener.
Is a 521 error my fault as a visitor?
No. It is between Cloudflare and the site's own server. Nothing in your browser or network affects it; try again later.