---
title: "Cloudflare Error 520: causes and how to fix it"
description: "Cloudflare reached your origin and got back a response it could not interpret — an empty reply, a malformed header, or a connection dropped mid-response. The…"
canonical: "https://lemwatch.com/errors/cloudflare-520"
source: "https://lemwatch.com"
---

# Cloudflare Error 520: Web server returned an unknown error

> Cloudflare reached your origin and got back a response it could not interpret — an empty reply, a malformed header, or a connection dropped mid-response. The origin is up but misbehaving.

## Short answer

 Cloudflare reached your origin and got back a response it could not interpret — an empty reply, a malformed header, or a connection dropped mid-response. The origin is up but misbehaving.

## What Cloudflare Error 520 means

 520 is Cloudflare's catch-all for 'the origin answered, but not with valid HTTP'. It is a symptom of the origin crashing, sending oversized headers, or resetting connections rather than a Cloudflare fault.

## Causes and fixes, most likely first

- The origin crashes or resets the connection mid-response. Check origin error logs at the exact timestamp. Memory-limit kills and PHP fatals produce this reliably.
- Response headers are too large for Cloudflare's limits. Trim large cookies and verbose headers. Cloudflare enforces stricter header limits than most origins.
- The origin returns an empty response with no status line. Reproduce by requesting the origin IP directly with the Host header set — bypassing Cloudflare shows the raw behaviour.

## How to stop it happening again

- Monitor the origin directly as well as the public hostname, so origin faults are visible before the edge masks them.
- Alert on 5xx rate rather than a single failed check — 520s are frequently intermittent.

## Check your own domain

 Probing the hostname externally and comparing against a direct origin request separates a Cloudflare-layer issue from an origin fault.

## Frequently asked questions

### Is error 520 Cloudflare's fault?

 Almost never. It means Cloudflare could not make sense of what the origin returned. The evidence is in the origin's logs.


## Related

- [All website error codes](https://lemwatch.com/errors)
- [Cloudflare Error 521](https://lemwatch.com/errors/cloudflare-521)
- [Cloudflare Error 522](https://lemwatch.com/errors/cloudflare-522)
- [Cloudflare Error 524](https://lemwatch.com/errors/cloudflare-524)
- [ERR_EMPTY_RESPONSE](https://lemwatch.com/errors/err-empty-response)
- [HTTP 502](https://lemwatch.com/http-status-codes/502)
- [HTTP 500](https://lemwatch.com/http-status-codes/500)
- [Free Uptime & response check](https://lemwatch.com/tools/website-uptime)
