Skip to content

520 Web Server Returned an Unknown Error

Cloudflare's catch-all: the origin returned something empty, malformed, or otherwise unintelligible.

Status

HTTP/1.1 520 Web Server Returned an Unknown Error

Details

  • Category: 5xx
  • Status: Unofficial (Cloudflare). Not registered with IANA. A server, framework, or CDN convention.
  • Specification: none, not defined by any RFC
  • Cacheable: Not cacheable
  • Response body: Allowed
  • Retry: Safe to retry

520 is what Cloudflare sends when the origin's response cannot be interpreted: an empty reply, a connection reset mid-response, oversized headers, or a violation of the HTTP framing rules. It is the 5xx equivalent of a shrug.

Because the cause is on the origin side, the useful diagnostic is always the origin's own logs, which Cloudflare cannot see. Requesting the origin directly, bypassing Cloudflare, is the fastest way to confirm.

Note: The 52x range is Cloudflare specific and never comes from the origin itself. The origin's own logs are the only place the real cause appears.

Common causes

  • The origin returned an empty response or reset the connection mid-response.
  • Response headers exceeding Cloudflare's size limits, often from oversized cookies.
  • An origin crash or process restart during the request.
  • Headers or framing that violate HTTP, produced by a custom or misconfigured server.

How to fix it

As the client

  • Retry. 520s are frequently transient.
  • If you control the site, request the origin address directly to see the real response.

As the server

  • Check origin error logs for crashes and resets around the timestamps of the 520s.
  • Shrink response headers, especially Set-Cookie, which is the usual size offender.
  • Verify the origin speaks valid HTTP, including correct Content-Length and chunked framing.

Examples

Cloudflare cannot read the origin response

HTTP request

GET / HTTP/1.1
Host: www.example.com

HTTP response

HTTP/1.1 520
Server: cloudflare
CF-RAY: 8a1c2f3d4e5f6789-IAD

See also