Contents
A 521 appears when Cloudflare reaches the address in your DNS records but the server there answers “connection refused”. The error page shows the browser and Cloudflare working and Host down. The request never reached your site, so you won’t find it in your site logs; what needs checking is the address and the connection itself.
What causes error 521
- A wrong IP in the A record: after moving to a new host, or a typo, so Cloudflare reaches a server that doesn’t host your site.
- A firewall refusing Cloudflare’s IPs: a security system on the server blocked Cloudflare’s addresses after seeing many requests from them.
- A stopped web server on the origin.
- A mismatched SSL/TLS mode: Full or Full (strict) while the server isn’t accepting connections on port 443.
- A stale AAAA record pointing to an IPv6 address the site doesn’t run on.
Fixing it as a visitor
There’s nothing to fix on your side. Try again later, or send the site owner the URL and the Ray ID at the bottom of the page.
Fixing it as the site owner
- Compare the IPs: open cPanel and note the server address in the General Information panel. Then in Cloudflare open DNS → Records and make sure the A records for the domain and
wwwpoint to that same address. You can also check them with the DNS lookup tool. - Delete stale AAAA records if they point to an address you don’t recognise or your server doesn’t use.
- Test the server directly:
curl -sv --resolve example.com:443:203.0.113.10 https://example.com/ -o /dev/null
Replace 203.0.113.10 with your server’s address. Connection refused confirms the server is refusing; an HTTP response means the server is up and the refusal is specific to Cloudflare’s IPs.
4. Check the SSL/TLS mode: in Cloudflare open SSL/TLS → Overview. Use Full (strict) once you’ve confirmed the server has a valid SSL certificate. For certificate errors, see Cloudflare error 526.
5. If the direct test works from your computer but Cloudflare fails, the server’s firewall may be blocking Cloudflare’s IPs. Contact support with the time and Ray ID so they can review the block.
6. If the server refuses connections from everywhere, the web server may be down, and that needs your hosting provider.
Prevention
- When migrating, update the A and AAAA records in Cloudflare as soon as the new server is ready, and keep the old one running until the move is complete.
- Use Full (strict) with a valid certificate on the server rather than Flexible.
- Don’t let security plugins auto-block addresses you don’t recognise without review; they may be Cloudflare’s.
On ArabyHost
You can point your domain to ns1.arabicode.com and ns2.arabicode.com without Cloudflare, or keep DNS at Cloudflare with an A record pointing to the IP shown in cPanel. Free SSL is issued automatically through AutoSSL, and once it’s in place Full (strict) works. Imunify360 protects the server, and support can review any block affecting Cloudflare’s IPs. See using Cloudflare with your hosting.
FAQ
What's the difference between 521 and 522?
With 521 the server refused the connection right away. With 522 the server didn't answer at all within the timeout, so Cloudflare gave up. The first usually means a closed port or an explicit refusal; the second means overload or a silent block.
I got 521 right after moving my site to a new host. Why?
The A record in Cloudflare most likely still points to the old IP, or to an address your site doesn't run on. Update it with the new server's IP shown in cPanel.
Can Cloudflare's SSL setting cause a 521?
Yes. In Full or Full (strict) mode Cloudflare connects to your server on port 443; if the server doesn't accept HTTPS connections, it refuses and you get a 521.