521 Unofficial (Cloudflare) 📋

521 Web Server Is Down: Origin Server Unreachable

Last updated: June 28, 2026 • 5 min read

✦ The Golden Answer: The 521 Web Server Is Down is a Cloudflare-specific status code. It indicates that Cloudflare could not establish a connection to your origin server — the web server (e.g., Apache, Nginx) is either down, not responding, or a firewall is blocking the connection. This is a critical error because visitors cannot access your site at all. The fix involves checking that your web server is running and that your firewall allows connections from Cloudflare's IP ranges.

Common Causes of 521 Errors

CauseExampleHow to Fix
Web server is stoppedApache or Nginx process crashed or was stopped manually.Restart the web server (e.g., sudo systemctl restart nginx).
Firewall blocking Cloudflare IPsFirewall rules block incoming connections from Cloudflare's IP ranges.Whitelist Cloudflare IP ranges in your firewall.
Server overloadedServer is out of memory or CPU, unable to accept new connections.Scale up resources or optimize the application.
Port misconfigurationWeb server is listening on a different port than Cloudflare expects.Ensure your web server listens on the correct port (usually 80 for HTTP, 443 for HTTPS).
Network connectivity issuesRouting problems, DNS issues, or network outages.Check network connectivity and DNS resolution.

Example: Cloudflare 521 Error Page

Cloudflare displays a user‑friendly error page for 521 errors:

HTTP/1.1 521 Web Server Is Down Content-Type: text/html <html> <body> <h1>521: Web Server Is Down</h1> <p>The origin web server is not available. Please try again later.</p> </body> </html>

How to Fix 521 Errors

  • Check if your web server is running: Log in to your server and check the status of your web server. For Nginx: sudo systemctl status nginx. For Apache: sudo systemctl status apache2. If it's stopped, restart it.
  • Check firewall settings: Verify that your firewall allows incoming connections on ports 80 and 443. Whitelist Cloudflare's IP ranges (available from Cloudflare's documentation).
  • Verify server resources: Check CPU and memory usage with top or htop. If the server is overloaded, add more resources or optimize your application.
  • Check server logs: Look at your web server logs and system logs for errors that might indicate why the server is not responding.
  • Test direct access: Bypass Cloudflare by accessing your origin server directly (e.g., using the server's IP) to see if it responds.

Preventing 521 Errors

  • Set up monitoring: Use monitoring tools (e.g., Uptime Robot, Pingdom) to alert you when your server is down.
  • Implement auto‑restart: Use process managers like systemd or supervisord to automatically restart your web server if it crashes.
  • Keep Cloudflare IPs updated: Cloudflare occasionally updates its IP ranges. Use a script to automatically update your firewall rules.
  • Use a load balancer: Distribute traffic across multiple servers to reduce the risk of downtime.

Frequently Asked Questions

Is 521 a client error or a server error?

It is a server error (5xx) because the origin server is not responding. Cloudflare is acting as a proxy and cannot connect to the origin.

Can I fix a 521 error from the client side?

No, it is a server‑side issue. Only the website owner or server administrator can fix it.

What is the difference between 521 and 522?

521 means the origin server refused the connection (e.g., server is down). 522 means the connection was established but the origin took too long to respond (timeout).