Cloudflare · HTTP 520

Cloudflare Error 520: Unknown Origin Error

Trace Cloudflare error 520 to an origin that closes a connection or returns an empty or malformed HTTP response. Compare edge headers with origin logs and test the origin directly.

Origin / Application

Decode a CDN or gateway error

Paste a captured HTTP response or enter a status and headers. Only the status and response headers are sent; common credential headers are filtered first.

Supports raw headers, full HTTP responses, JSON with status/statusCode and headers, cURL -v/-i response output, and HAR exports. HAR selects a server error first. cURL commands are never executed; request headers, response bodies, and common credential headers are excluded.

Diagnostic report

Error code / name

CF-520

Fault domain

Origin / Application

Why it happened

Cloudflare connected to the origin, but the origin closed the connection or returned a response that Cloudflare could not parse. Oversized headers, application crashes, and intermediary resets can all produce an unexpected response.

Actionable fixes

  1. Match the CF-Ray value and timestamp to reverse-proxy and application logs.
  2. Check origin logs for worker crashes, connection resets, and malformed status lines.
  3. Compare response headers and body size from the origin with a direct request from an allowed network.

Why this error happened

Cloudflare connected to the origin, but the origin closed the connection or returned a response that Cloudflare could not parse. Oversized headers, application crashes, and intermediary resets can all produce an unexpected response.

Actionable fixes

  1. Match the CF-Ray value and timestamp to reverse-proxy and application logs.
  2. Check origin logs for worker crashes, connection resets, and malformed status lines.
  3. Compare response headers and body size from the origin with a direct request from an allowed network.

Network failure point

Client -> Cloudflare Edge -> TCP/TLS OK -> Origin sends empty or invalid HTTP response -> X

Verify origin directly via CLI

curl -sS -v -I --connect-timeout 5 --max-time 20 --resolve example.com:443:ORIGIN_IP https://example.com/health

Configuration fix

nginx.confnginx
location / {
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_pass http://app;
}

Catch this failure before it becomes an outage

SteadyNode's multi-region HTTP checks record status and response headers, while Upstream Translator highlights unexpected origin responses before they become prolonged outages.

No credit card required.

Start for free

Frequently asked questions

What does Cloudflare error 520 mean?

Cloudflare received an empty, malformed, or otherwise unexpected response from the origin.

Can a firewall cause a 520?

Yes. A firewall or proxy can reset an established connection; correlate the CF-Ray value with origin and network logs before changing rules.

Cloudflare

Vercel and Netlify

AWS CloudFront and ALB

Fastly

Heroku and Render

Nginx and Envoy