Cloudflare error 521: web server is down

Updated 11 October 2026

Short answer

Error 521 means Cloudflare tried to connect to your server and was actively turned away. Either the web server software (Nginx, Apache, or your app) isn't running, or a firewall on your server is rejecting Cloudflare. First check the web server is running. If it is, check your firewall and security tools allow Cloudflare's IP addresses.

What's the problem

Visitors see "Error 521: Web server is down" on a Cloudflare page, with "Host" marked as the error.

Why it happens

  • The web server or app is stopped, after a crash, a reboot, or a failed deploy.
  • A firewall on the server blocks Cloudflare's IP addresses, often added by a security tool or the host.
  • The server is listening on a different port than Cloudflare connects to (80 for HTTP, 443 for HTTPS).
  • SSL mode mismatch: Cloudflare is set to connect over HTTPS but your server doesn't accept HTTPS.

How to fix it

  1. Check the web server is running. On a VPS: systemctl status nginx (or apache2, or your app). On managed hosting: check the control panel.
  2. Restart it and read its logs to see why it stopped.
  3. Allow Cloudflare's IP ranges in your server firewall and security plugins.
  4. Check your SSL setting in Cloudflare matches what your server supports. If your server has no certificate, "Full" or "Full (strict)" will fail.
  5. Ask your host whether they're blocking Cloudflare or have stopped the server.

What Preventionlabs checks

One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; uptime checked every 5 minutes, with an email when the site goes down and when it is back. With Cloudflare connected, it also shows which pages returned server errors (5xx) to visitors, and when; your SSL mode and the other settings that commonly cause this; which requests the firewall blocked, by Cloudflare's own rule names; recent deploys and account changes, with their times; DNS changes in the last 7 days.

Run your free report

Your first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.

Sources

  1. Cloudflare: Error 521official docsError 521 occurs when the origin web server refuses connections from Cloudflare.
  2. Cloudflare: Error 521official docsSecurity solutions at your origin may block legitimate connections from certain Cloudflare IP addresses ↗︎ .

Preventionlabs is independent and not affiliated with Cloudflare. Product names are used only to describe the problem.

← All of Cloudflare errors