Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Troubleshooting

Cloudflare 520-526 errors: what each means and how to fix it

Cloudflare 520 to 526 errors mean Cloudflare reached the edge fine but failed to get a good response from your origin server. Match the code to the failure: 520 empty response, 521 refused, 522 connection timeout, 523 unreachable, 524 response timeout, 525 TLS handshake failed, 526 invalid certificate.

The short answer
  • The visitor reached Cloudflare. The fault is between Cloudflare and your origin.
  • Origin firewalls blocking Cloudflare IP ranges cause many 521 and 522 errors.
  • 525 and 526 appear only with Full or strict SSL modes. Check the origin certificate.
Try the website status checkerFree, live, no signup

What does each Cloudflare 52x error mean?

Cloudflare origin errors, official meanings and the usual first fix
CodeMeaningCommon causesFirst fix
520Unknown, empty or unexpected responseOrigin crash, headers over 128 KB (often cookies), bad HTTP/2 setupCheck origin logs and HTTP/2 to origin
521Origin is down or refuses connectionsWeb server offline, Cloudflare IPs blockedStart the server, allow Cloudflare IPs, check port 80 or 443
522Connection to origin timed outFirewall blocks or rate limits Cloudflare IPs, overloaded origin, wrong IPAllow Cloudflare IPs, verify origin IP in DNS
523Origin is unreachableNo route to the origin IP, wrong DNS recordCorrect the A or AAAA record, check routing
524Origin connected but did not respond in timeLong-running request or overloaded originSpeed up or background the work, or move it off the proxy
525TLS handshake with origin failedNo valid certificate, port 443 closed, no SNI, cipher mismatchInstall a certificate, open the port
526Origin certificate cannot be validatedExpired, wrong hostname or missing intermediate, in Full (strict)Install a valid or Cloudflare Origin CA certificate

Per-error pages: 520, 521, 522, 523, 524, 525, 526.

Which timeouts and limits matter?

125 s

Default Proxy Read Timeout before Cloudflare returns 524, on all plans

Source: Cloudflare docs

19 s

How long Cloudflare waits for a SYN+ACK before a 522

Source: Cloudflare docs

90 s

Wait for data after the TCP connection, such as a TLS Server Hello

Source: Cloudflare docs

128 KB

Header size above which a 520 can occur, often from too many cookies

Source: Cloudflare docs

How do you troubleshoot any 52x error?

  1. 01

    Note the code, URL, time and cf-ray

    Cloudflare asks for these when you contact your host or support. The time and time zone help match logs.

  2. 02

    Test the origin directly

    Request the origin by its IP, bypassing Cloudflare, or temporarily set the DNS record to DNS-only. If it fails too, the origin is the problem.

  3. 03

    Allow Cloudflare IP ranges

    Firewalls, .htaccess rules and iptables that rate limit or block Cloudflare are the most common cause of 522, and a frequent one for 521.

  4. 04

    Check origin logs and load

    Look for crashes, overload, and requests that never finish.

  5. 05

    Match SSL mode to the origin

    Flexible uses port 80. Full and Full (strict) use port 443 and need a valid certificate. Mismatches produce 521, 525 and 526.

  6. 06

    Check intermediate devices

    Load balancers, caches and firewalls between Cloudflare and the origin can fail without showing in the origin log.

Cloudflare 502 and 504 are different

A 502 or 504 branded as Cloudflare can mean a Cloudflare-side issue rather than your origin, while 520 to 526 point at the origin connection. Read the error page text and the cf-ray, and check the Cloudflare status page when many sites fail at once.

Common questions

What does Cloudflare error 522 mean?

Cloudflare timed out connecting to your origin. The request reached Cloudflare, but your server did not complete the TCP connection in time, most often because a firewall blocks or rate limits Cloudflare IP ranges, or the origin is overloaded or offline.

What is the difference between 521 and 522?

A 521 means the origin actively refused the connection or is down. A 522 means the connection attempt got no answer within the timeout. Refused points to a stopped service or blocked IPs. A timeout points to packet drops, overload or a wrong IP.

How long before Cloudflare returns a 524?

The default Proxy Read Timeout is 125 seconds on all plans. Enterprise plans can raise it. Requests that regularly run longer, such as big exports, should move to a DNS-only subdomain or a background job with polling.

What do Cloudflare 525 and 526 mean?

Both are TLS problems between Cloudflare and your origin, shown with Full or Full (strict) SSL. A 525 means the handshake failed, for example no certificate or port 443 closed. A 526 means the certificate cannot be validated, such as expired or wrong hostname.

Is a Cloudflare 52x error my visitors fault?

No. The visitor reached Cloudflare. The fault is between Cloudflare and the origin. Only the site owner or host can fix it, usually by checking the origin server, firewall rules and SSL settings.

How do I get alerted when my site returns a Cloudflare error?

Use an uptime monitor that checks from outside your network and alerts on 5xx responses. Because Cloudflare returns the error from its edge, a monitor sees the same page visitors do.

Watch the origin Cloudflare cannot reach

Aepto checks your site from up to six regions and alerts you when it starts returning errors.