What 520 means
Unofficial, used by Cloudflare. Cloudflare connected to the website’s own server (the origin), but got back an empty, unknown or unexpected response that it couldn’t pass on.
When servers send it
When the origin crashes mid-request, resets the connection, or returns something that isn’t valid HTTP.
Common causes
- The origin application crashing or resetting the connection.
- Response headers over Cloudflare’s limit, often too many cookies.
- An empty response with no status line.
- A misconfigured HTTP/2 setup at the origin.
- A firewall or security plugin at the origin blocking Cloudflare’s IP addresses.
How to fix it as a developer
- Check the origin’s error logs at the time of the error.
- Make sure Cloudflare’s IP ranges are allowed by the origin’s firewall.
- Reduce cookie and header sizes.
- As a test, set the DNS record to DNS only (grey cloud) to see the origin’s own error.
How to fix it as a visitor
- Try again in a few minutes. The site’s own server is having problems; Cloudflare is just reporting it.
Related codes
- 502 Bad Gateway: A proxy or load balancer got an invalid response, or none at all, from the server behind it.
- 521 Web Server Is Down: The website’s server refused Cloudflare’s connection.
- 522 Connection Timed Out: Cloudflare couldn’t connect to the website’s server in time.
- 524 A Timeout Occurred: Cloudflare connected to the website’s server, but it took too long to send a response.
Where it’s defined
520 isn’t in any RFC or the IANA status code registry. It’s used by Cloudflare. Reference: Cloudflare docs: error 520.
Other 5xx codes
500 Internal Server Error · 501 Not Implemented · 502 Bad Gateway · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 511 Network Authentication Required · 521 Web Server Is Down · 522 Connection Timed Out · 523 Origin Is Unreachable · 524 A Timeout Occurred · 525 SSL Handshake Failed · 526 Invalid SSL Certificate
Or search them all in the HTTP status code list.