Cloudflare error 521: Web Server Is Down

The website’s server refused Cloudflare’s connection. This is an unofficial code used by Cloudflare. You won’t find it in the HTTP standard.

Web Server Is Down

5xx Server errorUnofficial: CloudflareCloudflare docs: error 521

The website’s server refused Cloudflare’s connection.

Example response
HTTP/2 521
server: cloudflare
cf-ray: 8f1c2a3b4d5e6f71-LHR
content-type: text/html; charset=UTF-8

<!DOCTYPE html>… Error 521: Web server is down …

What 521 means

Unofficial, used by Cloudflare. Cloudflare tried to connect to the website’s own server (the origin) and the connection was refused.

When servers send it

When the web server isn’t running, or a firewall actively rejects Cloudflare’s connections.

Common causes

  • The web server (nginx, Apache, the app) is stopped or crashed.
  • A firewall or security tool blocking Cloudflare’s IP addresses.
  • The origin listening on a different port than Cloudflare uses.

How to fix it as a developer

  • Check the web server is running and listening on ports 80 and 443.
  • Allow all of Cloudflare’s published IP ranges in the origin’s firewall.
  • Check security plugins or fail2ban haven’t banned Cloudflare addresses.

How to fix it as a visitor

  • Try again later. The website’s server is down.

Related codes

Where it’s defined

521 isn’t in any RFC or the IANA status code registry. It’s used by Cloudflare. Reference: Cloudflare docs: error 521.

Other 5xx codes

500 Internal Server Error · 501 Not Implemented · 502 Bad Gateway · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 511 Network Authentication Required · 520 Web Server Returned an Unknown Error · 522 Connection Timed Out · 523 Origin Is Unreachable · 524 A Timeout Occurred · 525 SSL Handshake Failed · 526 Invalid SSL Certificate

Or search them all in the HTTP status code list.

Questions people ask

What does HTTP 521 Web Server Is Down mean?
The website’s server refused Cloudflare’s connection. It’s an unofficial code used by Cloudflare, not part of the HTTP standard.
How do I fix Cloudflare error 521?
Make sure the web server is running, then check the origin’s firewall allows Cloudflare’s IP ranges. Most 521s are one of those two.
What’s the difference between 521 and 522?
521 means the connection was actively refused. 522 means the connection attempt got no answer in time.
↑↓ move↵ openesc close