This is a searchable reference for Cloudflare error codes — the HTTP 5xx codes Cloudflare itself emits (520–527), the 1000-series application errors, and the challenge/access codes. Each entry tells you whether the failure is happening at Cloudflare’s edge or at your origin server, what it means, and the most likely fix, so you can stop guessing which side to debug.
How it works
When a request fails, Cloudflare distinguishes its own errors from your origin’s by using a dedicated code range. A standard 502 Bad Gateway from your origin is passed through, but a 502 with a Cloudflare error page and a 5xx/10xx code is generated by Cloudflare. The 52x family describes the connection between Cloudflare and your origin:
520 Unknown error from origin (empty/malformed response)
521 Origin refused the TCP connection (web server down)
522 TCP connection to origin timed out
523 Origin is unreachable (bad route / DNS at edge)
524 Origin connected but did not return an HTTP response in time
525 TLS handshake to origin failed (Full/Full strict SSL)
526 Origin presented an invalid SSL certificate (Full strict)
The 10xx series are application-layer errors raised at the edge before the origin is ever contacted — 1020 (firewall rule), 1015 (rate limited), and the 1xxx Workers errors. Because these never reach your origin, fixing them means editing Cloudflare’s rules, not your server.
Tips and example
The fastest triage is the source column. If a code is marked Origin, look at your server, firewall, and certificates; Cloudflare is working. If it is marked Edge, the request never reached you — investigate Cloudflare’s SSL mode, firewall rules, or Worker code.
522 → check origin firewall allows Cloudflare IP ranges, raise timeouts
521 → confirm the web server process is running and the port is open
525 → install a valid origin cert, open 443, enable SNI
1020 → find and adjust the matching Cloudflare firewall/WAF rule
A persistent 524 almost always means a slow backend: Cloudflare’s default origin timeout is 100 seconds, so a long-running request that exceeds it returns 524 even though both servers are healthy. Everything runs in your browser; nothing is uploaded.