Cloudflare error 522 means Cloudflare could not finish connecting to your web server in time. Visitors see an error page instead of your site. Because the page carries Cloudflare’s logo, many owners blame Cloudflare first. In most cases, though, the fault sits on the server side, and a firewall is the usual suspect. Searches for 522 and its sibling errors rose sharply this autumn, so here are the timeouts behind them, the common causes and what to hand your host.
Cloudflare error 522 is a connection timeout between Cloudflare and your origin server. Cloudflare waits 19 seconds for the server to answer a connection request and 90 seconds for the first data after that. The most common cause is a firewall that blocks or rate limits Cloudflare’s IP addresses. Errors 520, 521, 523, 524, 525 and 526 point at other faults on the same path.
We read Cloudflare’s documentation for each 5xx error on 26 November 2026. The timeouts and causes below come from those pages.
What Cloudflare error 522 means
The two timeouts behind it
Every request to a proxied site passes through Cloudflare. Cloudflare then opens its own connection to your server. Cloudflare’s error 522 page names two points where that connection can time out.
First, Cloudflare sends the opening packet of a TCP connection and waits 19 seconds for a reply, retrying at set intervals. Second, once the connection exists, it waits 90 seconds for any data above the TCP layer. The first message of a TLS handshake is one example. Either silence ends in the same error page.
The difference still tells you something. A missing reply to the first packet suggests a firewall dropping traffic or a server that is down. A connection that opens and then goes quiet points at a server too busy to answer.
Where to look first
Cloudflare’s documentation names one cause above all others. Cloudflare’s IP addresses get blocked or rate limited on the server. That can happen in an .htaccess file, in iptables, in a hosting firewall or in a security plugin. All your visitors now arrive from Cloudflare’s addresses, so a server under attack may start treating those addresses as the attacker.
Ask your host whether its firewall limits requests per IP address. Cloudflare’s addresses carry far more traffic than any single visitor, so a limit set for people can trip on Cloudflare.
So start at the origin. Cloudflare’s own network rarely sits at the root of a Cloudflare error 522, and its status page will show if it does.
The causes of Cloudflare error 522
Server and firewall causes
The error 522 page lists several causes beyond the firewall. An overloaded or offline server drops incoming requests. Keepalives may be turned off on the web server. Packets can also be dropped on the way into the server.
Then there is the DNS record. The origin IP address in your Cloudflare DNS may no longer match the one your host gave the server. That often happens after a migration, when the old address stays behind in Cloudflare. The result is a Cloudflare error 522 for every visitor, while the new server sits idle.
Causes on Cloudflare’s own platform
A few causes are specific to Cloudflare’s developer products. For example, a Cloudflare Pages site needs a custom domain set up, with its CNAME record pointing at the Pages domain. A Worker on a custom domain that fetches its own hostname also triggers a Cloudflare error 522. In addition, an Origin Rule that points at a hostname resolving to a reserved address produces it too.
The list is long. Even so, most cases on ordinary hosting end after a handful of checks, in the order below.
Fixing Cloudflare error 522 step by step
The checks in order
Work through these checks in order and note what you find at each one. The notes save time if you end up calling your host.
- Load the site straight from the server’s IP address, for example with
curl -I --resolve example.com:443:<origin-ip> https://example.com. - Compare the origin IP in your Cloudflare DNS records with the IP your hosting account shows.
- Allow every range on Cloudflare’s published IP list in the server firewall and any security plugin.
- Remove any rate limits that apply to those ranges.
- Look at server load and the web server’s error logs for the times the errors appeared.
- On Cloudflare Pages or Workers, check the custom domain and any code that fetches the site’s own hostname.
Reading the result
The first check splits a Cloudflare error 522 in two. If the server answers directly but not through Cloudflare, a firewall is the prime suspect. If it does not answer directly either, the server itself has a problem, and Cloudflare is only reporting it.
A server that answers slowly sits in between. It may respond to your test and still time out under real traffic. In that case, look at capacity and at whatever else runs on the machine. Write down the exact time of each test as well, since hosts search their logs by timestamp.
Reporting a Cloudflare error 522 to your host
Hosts solve these faster with the right details. Cloudflare’s 5xx overview asks you to share the exact error code and message. Add the time and timezone when it occurred, and the URL that failed. Cloudflare also notes that the cause is not always in the web server’s own logs. Load balancers, caches, proxies and firewalls between Cloudflare and the server keep logs too.
The other Cloudflare host errors
Errors 520 to 526 at a glance
Cloudflare error 522 has six close relatives in the same family. Each one points at a different stage of the trip from Cloudflare to your server.
| Error | What Cloudflare says happened | First thing to check |
|---|---|---|
| 520 | The origin returned an empty, unknown or unexpected response | Crashes, malformed responses or headers over 128 KB |
| 521 | The origin refused the connection | Whether the web server runs and allows Cloudflare IPs |
| 523 | The origin is unreachable | The A and AAAA records and the network route |
| 524 | The origin connected but sent no response within 125 seconds | Slow pages, long reports or heavy database queries |
| 525 | The SSL handshake failed under Full or Full (Strict) mode | The certificate, port 443 and SNI support |
| 526 | The origin certificate is invalid under Full (Strict) mode | Expiry, the hostname on the certificate and who signed it |
What the siblings usually mean
Error 520 is the vaguest of the group. Cloudflare lists crashes, empty responses, a wrong HTTP/2 setup and response headers over 128 KB, often from too many cookies. Cloudflare’s note says 520 errors are common with certain PHP applications that crash the web server.
Error 521 often follows a crash of the web server process, or a firewall that rejects Cloudflare outright. Cloudflare also notes that Full or Full (Strict) SSL mode needs a server that accepts HTTPS.
Error 523 is about routing. One example in Cloudflare’s documentation comes from AWS. A broad route such as 172.0.0.0/8 in a VPC route table can capture traffic meant for Cloudflare, because Cloudflare uses public addresses in 172.64.0.0/13.
Error 524 is easy to confuse with a Cloudflare error 522. Here the connection succeeds, yet the server takes longer than the 125-second default to send a response. Long exports and reports are typical culprits, and moving that work into a background job is usually the lasting fix.
Errors 525 and 526 concern the encrypted link between Cloudflare and your server. They appear when the SSL mode is Full or Full (Strict) and the server’s certificate does not pass. Cloudflare suggests a Cloudflare Origin CA certificate on the server as one fix. Switching from Full (Strict) to Full only hides the problem, so treat it as a short stopgap.
Errors that do not come from your server
Unlike Cloudflare error 522, some errors start in Cloudflare’s own products. Error 1033 means a Cloudflare Tunnel has no healthy connector, which our Cloudflare Tunnel guide explains. A Worker on the free plan that passes its daily request limit returns error 1027. Error 1103 appears when a Workers spending limit blocks new requests.
These look like outages to visitors, yet the fix lives in your Cloudflare account. Check the dashboard before you call your host about any of them.
Preventing Cloudflare error 522
Most repeat cases come from firewalls that forget Cloudflare. The published IP list can change, so automate the allowlist from it. Treat any manual copy as a short-term measure. Also make sure any intrusion prevention on the server leaves those ranges alone.
Keepalives matter too. Cloudflare lists disabled keepalives among the causes, so leave them on in the web server configuration. Finally, give the server some headroom. A machine that runs at full load in busy hours will time out under the next spike.
Then watch for errors before visitors report them. Cloudflare’s Error Analytics, under HTTP Traffic in the dashboard, breaks errors down by code, URL and data centre. It works from a 1% sample of traffic. A spike in Cloudflare error 522 there usually shows up before the phone starts ringing.
For a server you control, a Cloudflare Tunnel removes the inbound firewall path altogether. The firewall causes of the error then no longer apply. A stopped connector shows up as error 1033 instead, which is quicker to diagnose.
Repeated host errors usually trace back to firewall rules, overloaded services or certificates nobody is watching. Our server security analysis reviews firewall rules, open ports, running services, logging and patch levels on Linux and Windows servers. The full tier fixes what we find, tunes the firewall and runs a verification scan 30 days later. If Cloudflare error 522 keeps coming back on your site, see our server security analysis or use the quote request form .