Cloudflare error · 521
Cloudflare error 521: web server is down
Cloudflare error 521 means Cloudflare could reach your origin’s IP and the origin refused the TCP connection. Nothing on that address accepted the connection on the port Cloudflare used. The visitor-facing name is “Web server is down.”
HTTP status codes explained · the longer reference on the blog.
What 521 means
521 is not a registered HTTP status. Your origin did not send it. Cloudflare’s edge tried to open a connection to the IP in the DNS record and got a reset or an immediate refusal. That is different from a timeout. A refusal is an active answer from the host, or from a firewall that rejects rather than drops.
The usual meaning is exact: the web server process is not listening. The machine can still be up, pingable, and serving SSH. nginx or the app stopped, it is bound to localhost only, or it is listening on a different port than Cloudflare is using. A firewall REJECT rule looks the same from the edge.
Common causes
The web server process is stopped
nginx, Apache, or Caddy is not running. The host is online, and port 443 has no listener. Cloudflare reports 521 for every proxied hostname on that origin.
The process is listening on the wrong interface or port
The app bound to 127.0.0.1, or to :8080, while Cloudflare connects to the public IP on 443 or 80. Local curl to localhost works. The edge still gets 521.
A firewall is rejecting the edge
An allow-list that omitted Cloudflare’s IP ranges, or a rule added during an incident, answers with RST. The connection fails immediately instead of hanging.
The DNS A record points at a dead address
The origin moved, and the proxied record still has the old IP. That address refuses or is unassigned. Update the record. The orange cloud does not fix a wrong IP.
How to fix it
Check the listener on the origin
On the server, confirm nginx or the app is running and bound to the public interface on the port you told Cloudflare to use. Start it if it is stopped, then reload.
Compare a local request with the public hostname
curl to 127.0.0.1 on the origin tells you the process is up. A connection to the public IP from outside tells you whether the path Cloudflare uses is open.
Review the firewall for reject rules
If the process is listening and the public IP still refuses, the firewall is the next layer. Allow the ports Cloudflare uses. Keep the rest of the allow-list intact.
Confirm the proxied DNS record
The A or AAAA record in Cloudflare should be the origin that is listening. After an IP change, update it and wait for the record to refresh. Then retry the public URL.
Is it your site, or just you?
521 is produced by Cloudflare for traffic that goes through the proxy. If you and a phone on another network both see it, visitors are seeing it. Your browser is not the cause.
The homepage checker uses public DNS, so it also goes through Cloudflare. HTTP 521 from the checker confirms the edge is refusing on our path too. Then test the origin process and the public port from the server itself, which bypasses your laptop.
How to monitor for 521
Monitor the public URL and expect 200. A 521 fails that check and alerts after one confirming check, with the status in the message. You do not need a Cloudflare-specific monitor type. When the web server listens again, the next successful check sends a recovery alert. The free plan checks every 10 minutes.
The checker on the ismysiteup homepage requests the URL from our servers and shows the HTTP status, response time, and SSL details. No account is required, and that checker allows 5 checks per hour from the same network. A free account watches 5 URLs, each checked every 10 minutes, and sends alerts on WhatsApp, Telegram, Slack, or email. A monitor expects HTTP 200 unless you set a different expected status (100–599). One failed check is confirmed with a second check before the first alert, and a later success sends a recovery alert. Pro (every 5 minutes) and Business (every minute) are listed on the pricing page; paid checkout is not open yet.
Related status codes
- 522Connection Timed OutCloudflare tried to open TCP to the origin and the handshake never finished.
- 523Origin Is UnreachableCloudflare could not find a route to the origin server.
- 520Web Server Returned an Unknown ErrorCloudflare connected, and the origin’s reply was empty or not valid HTTP.
- 502Bad GatewayA proxy received an invalid response from the server behind it.
FAQ
What does Cloudflare error 521 mean?
Cloudflare reached the origin IP and the connection was refused. The web server is not accepting connections on that port. Cloudflare calls this “web server is down.”
How is 521 different from 522?
521 is a refusal: the origin, or a firewall, actively rejected the connection. 522 is a timeout: the connection attempt did not finish. A dropped packet often looks like 522. A stopped web server often looks like 521.
Is error 521 a real HTTP status code?
No. It is Cloudflare’s code. A monitor still stores it as the status it received from the public URL, because that is the response visitors get.