# Cloudflare Error 520: Web Server Returned an Unknown Error

> Cloudflare got an empty, unknown or unexpected response from the origin server.

520 is Cloudflare's catch-all. The origin server returned something Cloudflare couldn't use: an empty reply, a reset connection, or headers it rejects (for example because they're too large). It's a cousin of 502 that only appears on sites behind Cloudflare.

- Class: unofficial (Cloudflare)
- Retry: With backoff (idempotent requests only)
- Cacheable by default: no
- Defined in: [Cloudflare docs — Troubleshooting Cloudflare 5XX errors](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/)

## Example response

```http
HTTP/1.1 520 Web Server Returned an Unknown Error
Content-Type: application/json
Content-Length: 48

{"error":"Web Server Returned an Unknown Error"}
```

## Common causes

- The origin crashed or reset the connection mid-response.
- Response headers over Cloudflare's size limit, often from oversized cookies.
- Empty responses from the origin.
- An origin firewall intermittently blocking Cloudflare's IP ranges.

## How to fix it

1. Check the origin's web server and application logs at the time of the error.
2. Request the origin directly (bypassing Cloudflare) to reproduce the failure.
3. Trim large response headers and cookies.
4. Allow all of Cloudflare's IP ranges in the origin firewall.

## FAQ

### Is a 520 Cloudflare's fault?

Rarely. It's Cloudflare reporting that your origin misbehaved; the origin's logs hold the answer.

## Related status codes

- [502 Bad Gateway](https://www.devkult.com/http/502.md)
- [521 Web Server Is Down](https://www.devkult.com/http/521.md)
- [522 Connection Timed Out](https://www.devkult.com/http/522.md)

Open the interactive page: https://www.devkult.com/http/520