Cloudflare error 520: Web Server Returned an Unknown Error

Cloudflare reached the website’s server but got back an empty, unknown or unexpected response. This is an unofficial code used by Cloudflare. You won’t find it in the HTTP standard.

Web Server Returned an Unknown Error

5xx Server errorUnofficial: CloudflareCloudflare docs: error 520

Cloudflare reached the website’s server but got back an empty, unknown or unexpected response.

Example response
HTTP/2 520
server: cloudflare
cf-ray: 8f1c2a3b4d5e6f70-LHR
content-type: text/html; charset=UTF-8

<!DOCTYPE html>… Error 520: Web server is returning an unknown error …

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

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.

Questions people ask

What does HTTP 520 Web Server Returned an Unknown Error mean?
Cloudflare reached the website’s server but got back an empty, unknown or unexpected response. It’s an unofficial code used by Cloudflare, not part of the HTTP standard.
Is a 520 error Cloudflare’s fault?
Usually not. Cloudflare is reporting that the website’s own server sent back something it couldn’t use. The fix is on that server.
What’s the difference between 520 and 502?
They’re similar: a proxy got a bad response from the server behind it. 520 is Cloudflare’s own code for the case where the response was empty or not understandable.
↑↓ move↵ openesc close