Error 521: Web Server Is Down
Cloudflare tried to reach the server behind it and was actively refused. A 521 is a problem on the website's side, and the refusal itself tells you the machine is reachable.
Updated September 2026 · 4 min read
-
Written by
Andrian Valeanu
Founder of Pulsetic
Andrian Valeanu founded Pulsetic. Before that, Designmodo. The 15-plus years in between went into web products, design tools and monitoring software that teams around the world run on.
-
Reviewed by
Ionut Caval
Technical reviewer
Ionut Caval reads every one of these guides before it goes out. Web servers, networking and uptime monitoring are his day job, so the causes and fixes here get checked against how things actually behave in production.
The short version: Reload after a minute: a 521 sits on the website's side and you cannot fix it as a visitor. It means the origin server refused Cloudflare's connection outright. Run the website yourself? Check the web server is actually running, that it listens on the port your SSL/TLS mode requires, and that nothing is rejecting Cloudflare IP ranges.
Key takeaways
- Your origin server actively refused the connection from Cloudflare. Something was listening and answered with a reset rather than staying silent.
- This is the website's problem, not yours. As a visitor there is nothing to fix beyond waiting and reloading.
- Cloudflare names two causes above all others: the web server application is offline, or Cloudflare's requests are being blocked.
- A refusal is diagnostically better news than silence. It means the machine is up and reachable, so the fault is a stopped service or a rejecting rule rather than a dead host or a broken route.
- If your SSL/TLS mode is Full or Full (Strict), the origin must serve HTTPS on port 443. A server listening only on port 80 in that mode produces a 521 every time.
- Error type
- Cloudflare 5xx edge error
- Whose side
- Always the website
- Fix difficulty
- Moderate (website owner)
- Common cause
- Origin service stopped or refusing Cloudflare
How did you find out this time?
Pulsetic is website uptime monitoring. It checks your URL from outside your network as often as every 30 seconds, confirms any failure from another region, then emails you.
10 monitors free, email alerts on failure and recovery. No credit card.
What does Error 521: Web Server Is Down mean?
A 521 Web Server Is Down is a Cloudflare-specific status code that appears when your origin web server refuses the connection Cloudflare tries to open. The name overstates it slightly: the machine is usually up and reachable, and something on it is answering the knock with a refusal.
Because the refusal happens between Cloudflare and the server behind it, a 521 is always a problem with the website's infrastructure. Your browser, device, and connection play no part in it.
- 521
- Cloudflare status code
- RST
- What the origin sent back
- 443
- Port needed for Full and Full (Strict)
- 2
- Causes Cloudflare names most often
How the Error 521: Web Server Is Down error appears
The wording changes depending on your browser, device, or server. Here is how this error commonly shows up:
521
Web server is down
The origin server refused the connection.
Error 521: web server is downError 521 CloudflareWeb server is down Error code 521HTTP 521Host Error: web server is downCloudflare 521 origin down
521 vs 522, 524 and 502
The Cloudflare 5xx codes each record a different outcome of the same attempt to reach your origin. Reading them precisely saves a lot of guessing.
| Code | What the origin did | Where to look |
|---|---|---|
| 521 Web Server Is Down | Refused the connection and sent a reset. Something was listening and said no. | Stopped web server, wrong port for the SSL/TLS mode, or a rejecting firewall |
| 522 Connection Timed Out | Said nothing. No SYN+ACK arrived within 19 seconds. | A firewall dropping packets, a saturated origin, or a stale origin IP |
| 524 A Timeout Occurred | Accepted the connection, then sent no HTTP response within 125 seconds. | A slow query or long-running request in the application |
| 502 Bad Gateway | Replied, but with something invalid or empty. | The upstream application behind the proxy, not the connection to it |
Which port your origin must listen on
A frequent 521 has nothing to do with firewalls: the origin is running, but on the wrong port for the SSL/TLS mode Cloudflare is using. These have to match.
| SSL/TLS mode | Origin must listen on | Origin certificate needed |
|---|---|---|
| Flexible | Port 80 (HTTP) | None. Cloudflare talks to the origin unencrypted |
| Full | Port 443 (HTTPS) | Any certificate, including self-signed or a Cloudflare Origin Certificate |
| Full (Strict) | Port 443 (HTTPS) | A valid certificate from a trusted CA, or a Cloudflare Origin Certificate |
What causes Error 521: Web Server Is Down?
- The web server application (nginx, Apache, Node, and so on) has stopped, crashed, or was never started after a reboot.
- A firewall or security product at the origin is rejecting Cloudflare IP ranges rather than allowing them.
- Your SSL/TLS mode is Full or Full (Strict) but the origin only listens on port 80, so nothing accepts the HTTPS connection.
- Your SSL/TLS mode is Full (Strict) and the origin certificate is missing, expired, or not from a trusted CA.
- The web server is bound to
127.0.0.1instead of a public interface, so external connections are refused. - The origin ran out of resources and the service was killed, for example by the kernel out-of-memory reaper.
How to find the cause fast
- Reload once after a minute, then check from elsewhere with Is Website Down? to confirm it is failing for everyone.
- Owners: run
nc -vz YOUR_ORIGIN_IP 443. "Connection refused" confirms a 521 and rules out the packet dropping behind a 522. - Check the service is alive and bound where you expect with
systemctl status nginxandss -lntp | grep -E ":80|:443". A service bound only to127.0.0.1shows up here immediately. - Match your Cloudflare SSL/TLS mode against the port the origin actually listens on. Full and Full (Strict) both require HTTPS on 443.
- Read the origin error log around the failure timestamps. A crash leaves an entry; a firewall rejection does not, and that absence is itself informative.
How Error 521: Web Server Is Down looks from the outside
A 521 comes back as a complete HTTP response from the Cloudflare edge, so an external check sees a fast reply carrying a 521 rather than an unreachable host. Recording the exact code is what makes the trio useful: 521 means the origin refused, 522 means it never answered, 524 means it answered then went quiet. A 521 that starts at the same instant across every checking location almost always means a service died or a rule changed, both of which need someone now rather than in the morning.
To confirm the exact code a URL returns, or to re-test several at once after a fix, run them through the free bulk URL status checker.
How to fix Error 521: Web Server Is Down
If you are a visitor
- Wait a minute and reload. A 521 caused by a crashed service often clears the moment it restarts.
- Try a different browser or a private window to rule out a cached error page.
- Check whether it is down for everyone with Is Website Down? If it is, only the owner can fix it.
- Nothing on your side is involved. A 521 is a conversation between Cloudflare and the website's server.
If you run the website
- Confirm the web server process is actually running, and restart it if not. This is the single most common cause.
- Check what the server is listening on with
ss -lntp. It must be bound to a public interface, not just127.0.0.1. - Match the port to your SSL/TLS mode: port 80 for Flexible, port 443 for Full and Full (Strict).
- On Full (Strict), install a certificate from a trusted CA or a Cloudflare Origin Certificate. A missing or expired one refuses the connection.
- Allow every Cloudflare IP range in your firewall and any security plugin. Rejecting them produces a 521 where dropping them would produce a 522.
- Look for out-of-memory kills or crash loops in the system journal if the service keeps stopping on its own.
Still not fixed? Next steps
- Confirmed the service is running and the port is right, and still getting 521? Ask your host whether a provider-level firewall or security product is rejecting Cloudflare IP ranges before traffic reaches your machine.
- Check whether the refusal is constant or intermittent. A service that crashes and restarts under load produces 521s in bursts that line up with your traffic peaks.
- Review the origin error log around the exact timestamps. A 521 caused by an application crash almost always leaves a matching entry; one caused by a firewall leaves nothing at all.
- On a managed stack where you cannot inspect firewalls or ports, give your host the affected hostname, the Cloudflare IP from your logs, and exact timestamps so they can trace the rejected connection.
How to prevent Error 521: Web Server Is Down
A 521 is usually binary: the service is up or it is not, and every visitor sees the error the moment it stops. That makes it one of the most damaging failures to discover late, and one of the easiest to catch early. Pulsetic checks your website from multiple locations as often as every 30 seconds, records the exact status code, and alerts you by email, SMS, voice call, Slack, Discord, and more the instant 521s begin. It will not restart the service for you, but you will know it stopped within seconds rather than hearing it from a customer.
Learn how Pulsetic's uptime monitoring detects this from the outside, across 15+ locations.
Sources and further reading
The specifications and vendor documentation this guide is written from, plus deeper reading on the parts it only summarises.
Frequently asked questions
-
Is Error 521 my fault or the website's?
The website's. A 521 means the site's own origin server refused a connection from Cloudflare, which is a conversation your device is not part of. Reload after a minute, and if it persists only the owner can fix it.
-
Does Error 521 mean the server is switched off?
Usually not. The name is misleading. A machine that is genuinely off or unreachable produces a 522, because nothing answers at all. A 521 means something did answer and refused, so the server is typically up while the web server software has stopped, is bound to the wrong interface or port, or a firewall is rejecting Cloudflare.
-
What is the difference between Error 521 and Error 522?
Refused versus ignored. A 521 means the origin sent back a reset, so it was reachable and declined. A 522 means the origin stayed silent and Cloudflare gave up after 19 seconds of retries. Practically, a 521 sends you to look at the web server process and its port, and a 522 sends you to look at packet filtering and reachability.
-
Can pausing Cloudflare fix a 521?
It will tell you a great deal, though it is a diagnostic rather than a fix. Pausing Cloudflare sends visitors straight to your origin. If the website then works, the origin is fine and something about the Cloudflare connection, most likely a rejecting firewall or an SSL/TLS mode mismatch, is the problem. If it still fails, the origin itself is broken and Cloudflare was only reporting it accurately.
-
Why did a 521 appear right after I switched to Full (Strict)?
Because the mode changed what Cloudflare requires of your origin. Flexible lets Cloudflare talk to the origin over plain HTTP on port 80, so a server with no certificate works fine. Full and Full (Strict) both require the origin to serve HTTPS on port 443, and Full (Strict) additionally requires a certificate from a trusted CA. Switching modes on a server that only ever listened on port 80 produces an immediate 521 across the whole site. Installing a free Cloudflare Origin Certificate and listening on 443 resolves it.
-
Can a security plugin cause a 521?
Yes, and it is a common cause on WordPress in particular. Security plugins maintain their own block lists and often add rules to
.htaccessor the host firewall automatically after what they read as suspicious traffic. Because all of your traffic arrives from a relatively small set of Cloudflare IPs, one false positive can get a Cloudflare range banned and take the entire site offline at once. Check the plugin block list for Cloudflare addresses before assuming the web server crashed. -
Does a 521 error hurt SEO?
A brief one will not, because crawlers retry after a 5xx. A sustained 521 is genuinely damaging: every crawl attempt fails, crawl frequency drops, and pages that keep returning the error can fall out of results until the origin answers again. Since the usual cause is a stopped service rather than something subtle, the exposure depends almost entirely on how quickly you notice, which is an argument for external monitoring rather than for anything on the page.
-
I get 521 on one subdomain but the main site is fine. Why?
Different hostnames can resolve to different origins, so this narrows the problem usefully. Check the DNS record for that specific subdomain in Cloudflare and confirm the IP still matches a live server, then confirm a web server on that machine is configured to answer for that hostname. A virtual host that was never defined, or was removed during a cleanup, refuses the connection while every other hostname on the account keeps working normally.
Trusted by teams at companies around the world
-
Catch the next outage before your visitors do.
2-minute setup · Cancel any time
-
No credit card needed