Docs menu
Docs · Error guide

Cloudflare Error Codes: 10xx Blocks and 520-524 Server Errors

A Cloudflare error code tells you which side failed, and a proxy fixes only the IP-based blocks: 1005 (network banned), 1006 to 1008 (IP banned), 1009 (country banned) and, with a slower pace, 1015 (rate limited). It cannot fix 1010 (browser signature), a challenge page without a real browser, 401, 404 or any 5xx error such as 520, 521, 522 or 524, which mean the website's own server failed, not your scraper. For the IP-based blocks, ProxyField residential proxies give you other IPs in 195+ countries from $1.95/GB; start with the Easy Trial: 1 GB for $2.95.

residential IPs
412M+
from, traffic never expires
$1.95/GB
Easy Trial
1 GB for $2.95

520, 521, 522 and 524 at a glance: the site's side in every normal case.

CodeCause, in one line (Cloudflare)The number to knowYour scraper's fault?
520the site's server sent an empty, malformed or unexpected answerresponse headers over 128 KB are one causeNo
521the site's server is down or refuses Cloudflare's connection–No
522the site's server is overloaded, down or blocking Cloudflare, so the connection timed outno SYN+ACK within 19 s, or no acknowledgment within 90 sNo; many threads on one host can add load
524the site's server connected but sent no HTTP response in time125 s, the default timeoutRarely; only by hammering a heavy page
On this page 8 sections

Which Cloudflare errors a proxy can fix

Every Cloudflare error falls into one of four groups: access denied, rate limiting, challenges, and origin and DNS errors. A proxy changes only your IP, network and country, so it helps only where the rule checks one of those.

GroupCodesWho caused itProxy helps? (ProxyField's assessment)What really fixes it
Access denied1005 (network banned)the site bans your network (ASN)Oftenan IP from a residential or mobile network
Access denied1006-1008, 1106 (IP banned)the site bans your IPYesa new IP
Access denied1009 (country banned)the site bans your country or regionYes, where use from another country is allowedcountry targeting
Access denied1010 (browser signature)the site bans your client's signatureNoa real, current browser with consistent headers
Access denied1012 (access denied)a site rule refused the requestRarelysend the Ray ID to the site owner
Access denied1020 (custom rule)a custom firewall rule matchedDepends on the field the rule checksfind that field: IP, country, user agent, path
Rate limiting1015, HTTP 429you passed the site's request limitPartlya slower pace and the Retry-After wait first; rotation spreads per-IP counts
ChallengesHTTP 403 with cf-mitigated: challenge, "Just a moment..."Cloudflare wants a real browserNo, not alonea real browser session that runs the page, as a visitor's would
Origin and DNS502-530, 1000-1004, 1016, 1018the website's server or its Cloudflare setupNowaiting; the site owner
Not Cloudflare401, 404a missing login, or a wrong URLNothe right credentials or URL

Codes, titles and HTTP statuses are Cloudflare's (1xxx errors, 5xx errors); the "Proxy helps?" column is ProxyField's assessment, not Cloudflare's. The rule of thumb: repeated 403, 429 or 10xx pages mean the site is limiting you; 52x pages mean the site is broken. For 429 and Retry-After, see 429 Too Many Requests; for what a proxy cannot change in general, see what proxies can and cannot fix.

How to read a Cloudflare error page

  • The number. "Error 1020", "Error 522" and so on. It names the rule or the failure; Cloudflare documents each one under HTTP status codes.
  • The Ray ID. A reference for that request, also sent as the cf-ray response header. You can't decode it, but the site owner can look it up in their Cloudflare account, so include it when you report a block.
  • The diagram (on 52x pages). It shows "You", "Cloudflare" and "Host" (the website's server) and marks which link failed, usually "Host: Error".

The 10xx number sits in the HTML body; the HTTP status underneath is a normal one: 403 for most blocks, 429 for 1015, 409 or 530 for some DNS and setup errors, 5xx for server failures. Your scraper sees the status; the page body has the Cloudflare number.

Tell the errors apart in your scraper

Log four things per failed response: the status, the cf-mitigated header (Cloudflare sets it to challenge on every challenge page), the Retry-After header, and the error number in the body.

Python
import re
import requests

PROXY = "http://<login>-country-us-city-new_york:<password>@gate.proxyfield.io:7000"
r = requests.get("https://example.com/", proxies={"http": PROXY, "https": PROXY}, timeout=30)

code = re.search(r"Error (1\d{3}|5\d{2})", r.text)
print(r.status_code,                       # 403, 429, 52x ...
      r.headers.get("cf-mitigated"),       # "challenge" on a challenge page
      r.headers.get("retry-after"),        # seconds to wait after a 429
      r.headers.get("cf-ray"),             # the Ray ID for the site owner
      code.group(1) if code else None)     # the Cloudflare number, e.g. 1020 or 522

The same check with cURL: curl -s -o /dev/null -D - https://example.com/ | grep -i -E '^(HTTP|cf-|retry-after)'.

You seeIt isNext step
403 and cf-mitigated: challengea challenge pagea real browser; a new IP alone won't do
403 and "Error 1005", "1006"-"1009" in the bodyan IP, network or country bananother IP, network or country
403 and "Error 1010" or "1020"a signature or custom rulea real browser; find the field the rule checks
429, or "Error 1015"rate limitingwait for Retry-After, then slow down
520-526the site's serverretry later with back-off

Cloudflare 10xx errors

The 10xx codes visitors and scrapers trigger, with Cloudflare's titles and HTTP statuses (1xxx errors):

CodeCloudflare's titleHTTP statusShort fix
1005Access Denied: Autonomous System Number (ASN) banned403Another network, such as a residential IP
1006, 1007, 1008, 1106Access Denied: Your IP address has been banned403Another IP; ask the owner if it is a mistake
1009Access Denied: Country or region banned403An IP in a country the site serves
1010The owner of this website has banned your access based on your browser's signature403A real, current browser; consistent headers
1012Access Denied403A site rule refused the request; send the Ray ID to the owner
1015You are being rate limited429Wait, then slow down
1020Access denied403Find which field the custom rule checks

Each of these, with step-by-step fixes, is in Cloudflare access denied errors. The other 10xx codes are configuration problems on the site's side: 1000 (DNS points to prohibited IP, 403), 1001 (DNS resolution error, 409), 1003 (direct IP access not allowed, 403), 1016 (origin DNS error, 530) and 1018 (could not find host, 409).

Are 520, 521, 522 and 524 my scraper's fault or the site's?

The site's, in every normal case; a scraper contributes only by overloading a heavy page with many threads. A 5xx page means your request reached Cloudflare and the failure is between Cloudflare and the website's server. If the site were blocking you on purpose, you would see 403, 429 or a 10xx number instead.

How to tell the cases apart in your logs:

PatternWhose sideWhat to do
52x on every URL of the site, also from a normal browser on another networkthe site's server or its Cloudflare setupwait and retry later
52x only on one heavy page, only when you run many threadsyour load adds to a slow serverlower the concurrency on that host and back off
52x on many unrelated sites at onceCloudflare itselfcheck Cloudflare's status page
403, 429 or a 10xx number insteadyou are being limited, not a server failuresee the table above

One check settles most cases: load the same URL a few minutes later from a normal browser on another network. If it fails there too, it is the site.

Cloudflare 5xx errors: 502 to 530

CodeCloudflare's titleTypical causes (Cloudflare)Your scraper's fault?
502 / 504Bad gateway / gateway timeoutno valid or timely answer from the site's serverNo
503Service temporarily unavailablethe service is overloaded or downNo; retry later
520Web server returns an unknown errorthe server crashed or is misconfigured; an empty or malformed answer, or one without proper headers; a firewall or security plugin blocks Cloudflare's IPs; response headers over 128 KB (often too many cookies); a wrong HTTP/2 setup at the server; Authenticated Origin Pull turned on without the server set up for itNo
521Web server is downthe web server application is offline, or the server blocks Cloudflare's requestsNo
522Connection timed outthe server is overloaded, down or blocking Cloudflare, so there is no SYN+ACK within 19 seconds or no acknowledgment of the request within 90 secondsNo; if you run many threads on that host, lower the concurrency and retry after 30 s, then 60 s, then 120 s
523Origin is unreachableCloudflare could not reach the site's server at allNo
524A timeout occurredthe server accepted the connection but sent no HTTP response within the default 125 seconds: a slow query, too much work, too few resourcesRarely: only if your requests overload a heavy page; back off the same way
525SSL handshake failedTLS between Cloudflare and the site's server failedNo
526Invalid SSL certificatethe site's server has an invalid certificateNo
530(with 1016 or 1033 in the body)origin DNS error or a tunnel errorNo

Titles and causes from Cloudflare's per-code pages. None of these is caused by your proxy, your IP or your scraper's headers, so changing them does nothing. What you can do as a scraper:

  1. Retry later, with back-off (for example 30 s, then 60 s, then 120 s; this pattern is ordinary practice, not a Cloudflare figure), and stop after a few tries.
  2. Check whether the whole site is down from another network or a normal browser; if it is, wait.
  3. Check Cloudflare's status page when many unrelated sites fail at once.

If you run the site, Cloudflare's 520 page gives these checks:

  • As a temporary workaround, set the affected DNS record to DNS-only, or pause Cloudflare, and see whether the error follows the server.
  • Turn off HTTP/2 to Origin under Speed > Settings > Protocol Optimization if the server's HTTP/2 setup is in doubt.
  • In Origin Analytics, compare originResponseStatus with edgeResponseStatus: a 200 from the server served as a 520 means a malformed answer, such as oversized headers or an early close.
  • In Logpush, OriginResponseStatus 0 is a failed connection only when CacheStatus is "miss" or "expired".
  • For support, send the URL, the Ray ID, the output of /cdn-cgi/trace on your domain and two HAR files, one with Cloudflare on and one with it paused.

For a 403 with a Cloudflare page, start with Cloudflare 403 Forbidden. For why Cloudflare challenges a client in the first place, see why Cloudflare thinks you are a bot.

Seeing a Cloudflare error as a visitor

  • A 10xx page: turn off your VPN or proxy, update your browser, pause extensions, and wait a few minutes after a 1015. If it persists, send the Ray ID to the site owner.
  • A 52x page: the site is having problems. Reload in a few minutes; nothing on your device causes it.
  • A "Just a moment..." page that loops: allow JavaScript and cookies for the site and try another browser.

Cloudflare Error Codes FAQ

What do Cloudflare error codes mean when I'm scraping, and which of them can a proxy actually fix?

ProxyField sorts Cloudflare errors into 4 groups: access denied (1005, 1006 to 1010, 1012, 1020), rate limiting (1015 and 429), challenges (403 with cf-mitigated: challenge) and origin errors (502 to 530). A proxy fixes only the IP-based blocks: 1005 (network), 1006 to 1008 (IP), 1009 (country) and part of 1015 rate limits. It does not fix 1010, challenge pages without a real browser, 401, 404 or any 52x error.

What causes Cloudflare errors 520, 521, 522 and 524, and are they my scraper's fault or the site's?

The site's, in every normal case: 520 is an empty or malformed answer from the server (a crash, headers over 128 KB, a wrong HTTP/2 setup), 521 a server that is down or blocks Cloudflare, 522 an overloaded or blocking server that did not answer within 19 or 90 seconds, and 524 no response within 125 seconds. Your scraper can add to a 522 or 524 only by hammering a heavy page with many threads. If you are being blocked, you see 403, 429 or 10xx pages instead.

What does a Cloudflare error mean?

The website uses Cloudflare, and either one of its Cloudflare rules blocked your request or Cloudflare could not get an answer from the website's server. The code on the page tells you which.

How do I fix a Cloudflare error?

Read the code first. For 10xx blocks, change what the rule checks (VPN or proxy, browser, pace) or ask the site owner with the Ray ID; for 52x errors, wait and retry, because the website's server has to recover.

What are the most common Cloudflare error codes when scraping?

403 block and challenge pages, 1020 (a custom firewall rule), 1015 (rate limiting), 1010 (browser signature) and 1005 or 1009 (network or country bans). 52x codes show up too, but they mean the site's server failed, not that you were blocked.

How can my scraper tell which Cloudflare error it got?

Log the HTTP status, the cf-mitigated header, the Retry-After header and the "Error NNNN" number in the body. cf-mitigated: challenge marks a challenge page, 429 or 1015 marks rate limiting, 1005 to 1020 in a 403 body marks a rule, and 52x marks the site's server.

What is a Cloudflare 520 error?

Cloudflare's title is "Web server returns an unknown error": the website's server sent an empty, malformed or unexpected answer, often after a crash or with response headers over 128 KB. It's on the site's side; retry later.

What is Cloudflare error 521?

"Web server is down": the website's server application is offline or blocks Cloudflare's requests. Only the site owner can fix it; wait and retry.

What is Cloudflare error 522?

"Connection timed out": the website's server did not answer Cloudflare's connection within 19 seconds, or did not acknowledge the request within 90 seconds. The server is overloaded, down or blocking Cloudflare, so the fix is on the site's side.

What is Cloudflare error 524?

"A timeout occurred": the website's server accepted Cloudflare's connection but did not answer within the default 125 seconds. Heavy pages or overloaded servers cause it; retry later and don't hammer the page.

Show 2 more questionsShow fewer questions

What errors are caused by Cloudflare downtime?

When Cloudflare itself has an incident, many unrelated sites show 5xx errors at the same time. Check Cloudflare's status page; if an incident is listed, nothing on your side or the website's will fix it until Cloudflare does.

Why does a Cloudflare page say "failed"?

On 52x pages, Cloudflare's diagram shows your browser, Cloudflare and the website's server and marks the failed link, usually "Host: Error". That means the website's server failed, not your connection.

Easy Trial: 1 GB for $2.95.

Try for the price of 1 GB, no subscription, traffic never expires.