520 Web Server Returned an Unknown ErrorWhat error 520 means
HTTP 520 isn't in any RFC — it's a Cloudflare-specific status. When a site sits behind Cloudflare, the edge proxies your request to the site's real origin server. A 520 means that hand-off went wrong in an unclassifiable way: the origin returned an empty response, reset or closed the connection mid-exchange, replied with malformed or illegal headers, or sent nothing before disconnecting. Cloudflare files everything it can't categorize under 520, which is why it's labeled an unknown error.
The usual culprits live on the origin: a crashing application process, a web server that resets connections under load, restrictive origin-side security software dropping requests it dislikes, or keepalive and timeout mismatches between Cloudflare and the origin.
One cause sits squarely on the client side, and it matters for scrapers: oversized request headers. Cloudflare documents header payloads over roughly 32 KB — almost always runaway cookies accumulated over a long session — as a direct 520 trigger. If your crawler reuses one cookie jar for hours, rule this out first.