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

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

How to fix it

As the client

As the server

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