Help for owners
My website shows a Cloudflare error page instead of my site
Short answer
A Cloudflare error page means Cloudflare itself is working, but it cannot get a good answer from your own server. Error 521 means the server refused the connection, 522 means the connection timed out. Cloudflare says the most common cause of 522 is its addresses being blocked or rate limited at the server, so check with your host.
Does this sound like your situation?
- The page says Web server is down, with an error code and a Cloudflare logo.
- It says Connection timed out, error 522.
- The browser says too many redirects.
- It started after I moved hosting, changed my server address or turned on https.
- The site works if I turn Cloudflare off.
Why does this happen?
The server refuses Cloudflare (521)
Cloudflare describes 521 as the origin web server refusing connections. Two common causes: the web server application is down or crashed, or security software on it blocks Cloudflare addresses.
Confirmed by developers.cloudflare.com
The server does not answer in time (522)
Cloudflare says a 522 is a timeout contacting the origin, and that the most common cause is Cloudflare IP ranges being rate limited or blocked by .htaccess, iptables or firewalls. An overloaded or offline server, or dropped packets, can also cause it.
Confirmed by developers.cloudflare.com
Cloudflare points at the wrong server address
The same page lists a DNS entry whose origin address no longer matches the one the host currently gave you. This is common right after a move or a rebuilt server.
Confirmed by developers.cloudflare.com
The encryption mode does not match the server
On 521, Cloudflare says that in Full or Full (Strict) mode the origin must support HTTPS, and that the server must listen on port 80 for Flexible and 443 for Full and Full (Strict).
Confirmed by developers.cloudflare.com
A redirect loop
Cloudflare lists a mismatch between its encryption mode and redirects at the server, such as Flexible mode with the server redirecting HTTP to HTTPS, or conflicting redirect rules, as causes of too many redirects.
Confirmed by developers.cloudflare.com
What can I do about it today?
- Write down the exact error number521, 522 and a redirect loop have different causes. Screenshot the page including the code.
- Check that the server is onAsk your host, or look in the host's control panel, whether the server is running and not over its limits. This is read-only.
- Do not turn Cloudflare off in a panicPausing it can expose the server's address and drop protection. It also often does not fix the real fault.
- Ask what changedA new server, a host change, a firewall update, a certificate change or a new redirect rule. Cloudflare's docs point to these first.
- Do not change the encryption mode by trialSwitching between Flexible, Full and Full (Strict) can cause a loop or expose traffic. Leave it for someone who has checked the server certificate.
- Tell the host to allow CloudflareAsk them in writing whether Cloudflare's address ranges are allowed through the firewall, since that is the first item in Cloudflare's own list.
When should I bring someone in?
- The host says the server is fine and the error remains.
- It followed a host move, a new server or a change in https settings.
- The error comes and goes under load.
How do I handle it?
- Separate Cloudflare from the serverI check whether the server answers directly and what it logs when Cloudflare connects.
- Match the address and the portsThe server address in DNS, the listening ports and the encryption mode are compared.
- Check the firewall and rate limitsServer firewall, security plugins and host-level limits are reviewed to be sure Cloudflare is not treated as an attacker.
- Fix redirects in one placehttps redirects are set in one layer only, not both, so they cannot fight each other.
- Test and keep a written setupI test several pages and keep a short note of the settings and why they are what they are.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Does the error mean Cloudflare is down?
Usually not. The page is delivered by Cloudflare, and it is reporting that it could not get a proper reply from your server.
What is the difference between 521 and 522?
Cloudflare describes 521 as the server refusing connections and 522 as a connection timing out. Both often involve blocked Cloudflare addresses or a server that is down.
Will it fix itself?
If the server was briefly overloaded it may. A blocked address, a wrong server address or a mode mismatch does not clear on its own.
Should I get rid of Cloudflare?
Not as a fix. The same server fault would still be there, only visible in a different way.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.