What Cloudflare 521 means
Cloudflare couldn’t open a TCP connection because the origin refused it. Either the web server isn’t running, or a firewall on the origin blocks Cloudflare’s IPs.
521 isn’t defined in any HTTP standard. It is specific to Cloudflare, so other servers and proxies won’t use it.
How to fix error 521
- Check that nginx or Apache is running and listening on 80/443.
- Allow Cloudflare’s IP ranges in your firewall and in tools like fail2ban.
Retrying
Yes, usually. It is often temporary, so retry with exponential backoff and give up after a few attempts.
Example response
HTTP/1.1 521 Web Server Is Down
Date: Wed, 21 Oct 2026 10:30:00 GMT
Server: cloudflare
CF-RAY: 8c2f6a1e3b9d4e21-FRA
Content-Type: text/html; charset=UTF-8
Related status codes
- 522 Connection Timed Out : The TCP connection to the origin server timed out.
- 520 Web Server Returned an Unknown Error : The origin server returned an empty, unknown or unexpected response.
- 502 Bad Gateway : A proxy or gateway got an invalid response from the upstream server.
Other 5xx status codes
500 Internal Server Error · 501 Not Implemented · 502 Bad Gateway · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 507 Insufficient Storage · 508 Loop Detected · 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
See the full list of HTTP status codes.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does Cloudflare 521 Web Server Is Down mean?
Cloudflare 521 Web Server Is Down means the origin server refused the connection. Cloudflare couldn’t open a TCP connection because the origin refused it. Either the web server isn’t running, or a firewall on the origin blocks Cloudflare’s IPs.
How do I fix Cloudflare 521?
Check that nginx or Apache is running and listening on 80/443. Allow Cloudflare’s IP ranges in your firewall and in tools like fail2ban.