What is a 520 status code and how to avoid it?
TL;DR
A 520 error means Cloudflare reached the origin server but got back an empty or invalid response. It's Cloudflare-specific, not a standard HTTP code. Reduce it by sending complete request headers, pacing requests, and retrying with exponential backoff.
What is a 520 status code and how to avoid it?
A 520 error is Cloudflare-specific, meaning "Unknown Error" or "Web Server Returned an Unknown Error." It occurs when Cloudflare successfully connects to the origin server but receives an unexpected or empty response. This happens when servers are overloaded, misconfigured, or reject a request without returning a proper error. It is not a standard HTTP status code and only appears on Cloudflare-proxied sites.
Why 520 errors occur
Origin servers return invalid responses when they are overloaded, crash or time out under load, have firewall rules that drop Cloudflare's connections, send oversized headers, or close the connection without a response.
For scrapers, a spike in 520s usually means request volume is too high for the origin, or requests are malformed (missing headers, unusual header sizes). The server tells Cloudflare "something's wrong" without specifying what.
How to avoid 520 errors
Send complete, well-formed request headers including an honest User-Agent, Accept, and Accept-Language. Pace requests and respect rate limits so you are not adding load to a struggling origin. Implement retry logic with exponential backoff, since temporary overload often resolves within seconds.
Monitor error rates per domain. If 520s rise as you increase concurrency, lower it for that site; if they persist at low volume, the origin is likely misconfigured and retries alone will not help.
How Firecrawl handles 520 errors
Firecrawl returns the site's final status code in each result's metadata, so your pipeline can see a 520 and decide whether to retry, log, or skip the URL. The default auto proxy mode escalates to enhanced proxies only when a site responds with 401, 403, or 429 (see the enhanced mode docs), so a 520 is not retried that way; handle it with your own backoff. For errors from Firecrawl's API itself, the errors reference marks which codes, such as 502, 503, and 504, are safe to retry.
When scraping feeds production systems, reliability becomes a support question as much as a technical one. Firecrawl Enterprise includes a priority support SLA and a dedicated Slack channel, plus custom concurrency so you can tune load per workload.
Key Takeaways
520 errors are Cloudflare-specific, indicating the origin server returned an empty or invalid response. They are usually caused by origin overload, misconfiguration, or malformed requests. Reduce them with complete headers, paced requests, retries with backoff, and per-domain error monitoring.