520 Web Server Returned an Unknown Error
unofficial · Cloudflare
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 — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | Cloudflare docs — Troubleshooting Cloudflare 5XX errors |
Example response
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
- Check the origin's web server and application logs at the time of the error.
- Request the origin directly (bypassing Cloudflare) to reproduce the failure.
- Trim large response headers and cookies.
- Allow all of Cloudflare's IP ranges in the origin firewall.
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
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