Cloudflare: Error 520: Web server returns an unknown error
Last verified
Error 520: Web server is returning an unknown errorWhat it means
520 is a Cloudflare-specific status. Cloudflare connected to the site's origin server, but the origin returned something Cloudflare could not use: an empty or malformed response, a response without a status line, or a connection that was dropped. It is a catch-all for unexpected origin behavior.
For visitors and automation, 520 is not about you. Nothing in your request is blocked; the site's own server misbehaved. Retrying later is the only client-side action.
For the site owner, Cloudflare lists causes including origin crashes or misconfigurations, response headers over 128 KB (often from excessive cookies), empty or malformed responses, incorrect HTTP/2 configuration at the origin, and Authenticated Origin Pulls enabled on Cloudflare while the origin is not configured for it.
What it looks like
HTTP/1.1 520
Server: cloudflare
Error 520 ... Web server is returning an unknown error ... Ray ID: 8a1b2c3d4e5f6789Why it happens
- The origin application crashed or reset the connection (common with some PHP applications).
- Response headers exceed 128 KB, often because of large or numerous cookies.
- The origin sent an empty or malformed response with no status code.
- The origin advertises HTTP/2 but does not support it properly.
- Authenticated Origin Pulls is enabled but the origin rejects Cloudflare's client certificate.
How to fix it
- Visitors and automation: retry later with backoff; report persistent errors to the site with the Ray ID.
- Site owners: check origin error logs for crashes at the timestamps of the errors.
- Measure response header size and reduce cookies if it approaches 128 KB.
- Disable HTTP/2 to Origin under Speed, Settings, Protocol Optimization to test whether HTTP/2 is the cause.
- As a temporary diagnostic, set the DNS record to DNS-only; if the problem persists, collect the Ray ID, /cdn-cgi/trace output and HAR files for Cloudflare support.
How to stop it recurring
Site owners: monitor origin crash rates, keep cookies small, test HTTP/2 support before enabling it, and alert on 5xx rates in Cloudflare's analytics. Integrators: treat 520 as transient with capped retries.
Official documentation: developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-520. See all Cloudflare error messages.
Related errors
Definitions
- CAPTCHACAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a challenge-response m
- Cloudflare Bot ManagementCloudflare Bot Management is the set of Cloudflare features (Bot Fight Mode, Super Bot Fight Mode and the Ente
- Cloudflare TurnstileCloudflare Turnstile is Cloudflare's free CAPTCHA replacement: a widget that runs invisible browser checks, is
- User AgentA user agent is a string that browsers send with every HTTP request identifying the browser type, version, and
- Rate LimitingRate limiting is a technique that controls the number of requests a client can make to a server within a given
Quick answers
What does "Error 520: Web server returns an unknown error" mean in Cloudflare?
520 is a Cloudflare-specific status. Cloudflare connected to the site's origin server, but the origin returned something Cloudflare could not use: an empty or malformed response, a response without a status line, or a connection that was dropped. It is a catch-all for unexpected origin behavior. For visitors and automation, 520 is not about you. Nothing in your request is blocked; the site's own server misbehaved.
How do I fix "Error 520: Web server returns an unknown error"?
1. Visitors and automation: retry later with backoff; report persistent errors to the site with the Ray ID. 2. Site owners: check origin error logs for crashes at the timestamps of the errors. 3. Measure response header size and reduce cookies if it approaches 128 KB. 4. Disable HTTP/2 to Origin under Speed, Settings, Protocol Optimization to test whether HTTP/2 is the cause. 5. As a temporary diagnostic, set the DNS record to DNS-only; if the problem persists, collect the Ray ID, /cdn-cgi/trace output and HAR files for Cloudflare support.
Retries and timeouts without writing the loop
Autonoly's HTTP Request node and browser steps have per-node retries, timeouts and continue-on-fail, so a transient 429 or 503 can back off instead of failing the run. It has no proxies or IP rotation: if a site blocks automated traffic, that block applies to Autonoly too.
Also see Error handling in workflows.