This site is not affiliated with Cloudflare; this is an independent explanation.
The 521 error code reads "Web server is down". It is a Cloudflare code, not an official HTTP one, and it appears on sites that route their traffic through Cloudflare. It says that Cloudflare itself is fine, but when it knocked on the door of the real server, the door was shut or the connection was refused.
That is stronger than a slow reply. In a 522 the server stays silent, while in a 521 something actively says no, or nothing is running to say yes. For a visitor the page is simply unavailable until the owner brings the origin back. Most 521 errors on small sites end with a host restart or a firewall fix.
Common causes
1Origin web server is switched off or crashed
How to tellThe whole site is down, every page shows the same 521
What fixes itOwner restarts the web service or the machine from the host panel
2Server firewall blocks Cloudflare
How to tellBegan after a new security tool or firewall rule
What fixes itOwner allows Cloudflare's published address ranges
3Web server listens on the wrong port
How to tellFollowed a server change or a switch to secure connections
What fixes itOwner makes the server listen on the port Cloudflare is set to use
4Host is under maintenance
How to tellHosting company announced work or the error appears at set hours
What fixes itWait; check the host's status notice
5Server overloaded and refusing new connections
How to tellSite flickers between working and 521 at busy times
What fixes itOwner raises connection limits or upgrades the server
6Origin IP address changed
How to tellMoved to a new host and the old address is still set up
What fixes itOwner updates the DNS record to the current address
How to fix it, step by step
Reload after a couple of minutes
A restart can last a short while. Wait two minutes and try once more. If the host is rebooting the server, the site returns without any action from you.
See whether others are blocked too
Get a friend on another network to open it, or switch to mobile data. Because the origin is refusing Cloudflare itself, everyone usually sees the same 521 at once.
Try the address again with and without www
Sometimes the plain and the www versions of a site point to different servers. Test both. If one works, use it until the owner fixes the other.
Look for a notice from the site
Check the site's official social media or support page. Owners often post about planned downtime, which saves you further troubleshooting.
Come back later and avoid sensitive tasks
If the page was a payment or a form, wait until the site loads normally again. Check your bank or order history before repeating an action that may have partly gone through.
Owners: start the web service and test
Log in to your hosting account, confirm the server is running and the web service is active, then restart it. Test the site again.
Owners: allow Cloudflare addresses
Add Cloudflare's address ranges to the allow list of your firewall and security tools, and make sure no rate limit counts them as one visitor.
What the 521 error code means in plain words
Your browser talks to Cloudflare, and Cloudflare talks to the origin server. A 521 means the second connection was refused at the door. This often happens because nothing is listening on the expected port, or a firewall is rejecting the connection on purpose. Cloudflare tells visitors "web server is down" so that they know the problem is not their phone or Wi-Fi.
A local shop's website shows Error 521 Web server is down on a Monday morning. The owner's hosting plan ran out of memory over the weekend and the web service stopped. Once the host restarted it, the site worked again.
521 compared with 522, 520 and 503
| Code | What the origin did | Typical cause |
|---|---|---|
| 503 | Said it is busy or in maintenance | Overload or planned work |
| 520 | Sent an unknown or empty reply | Script crash |
| 521 | Refused the connection | Server off or firewall |
| 522 | Did not answer in time | Overload or network path |
Full pages exist for error 522, error 520 and 503 Service Unavailable. Browse more under HTTP status codes.
Fixing a 521 when you run the website
- Check that the origin is up by reaching it directly from another network.
- Restart the web service and read its log to see why it stopped.
- Match ports between the server and your Cloudflare settings, especially after enabling secure connections.
- Review firewall rules and any automatic blocking tool that may have banned Cloudflare addresses.
- Ask your host whether they are doing maintenance or have blocked the server for a plan limit or an unpaid bill.
Do not turn off the firewall to test. Allow the needed addresses instead, so your server stays protected.
Should visitors worry about a 521?
No. A 521 is a sign the website is unreachable, not that your device or data is at risk. Wait, retry later and avoid fixes from sites that claim to repair a 521 from your end. If the page matters, find another way to reach the business, such as a phone call or its app.
Frequently asked questions
What is error code 521?
It is a Cloudflare error that means the site's own web server refused the connection or is not running, so Cloudflare cannot fetch the page.
What does web server is down error code 521 mean for me?
It means the website is down at its source. Your internet and device are fine. Try again later or contact the site.
How do I fix the error code 521 Cloudflare message?
Visitors cannot fix it. Owners should start the web server, allow Cloudflare addresses in the firewall and make sure the right port is open.
How is a 521 different from a 522?
With a 521 the origin refuses the connection quickly. With a 522 the origin does not reply before the time runs out.
Can a 521 be caused by my browser?
Almost never. A private window test costs seconds, but because Cloudflare shows the page, the connection to the origin is what failed.