HTTPfy

520 Web Server Returned an Unknown Error

Cloudflare: the origin returned an empty, unknown or unexpected response.

520 at a glance

Code
520
Name
Web Server Returned an Unknown Error
Class
5xx Server error
Status
Non-standard used by Cloudflare
Documented by
Cloudflare
Cacheable by default
No by default. Caches only store responses with unrecognised status codes if explicit freshness (Cache-Control max-age) is given.

What 520 means

Cloudflare returns 520 when it connected to your origin but the response was something it could not use: an empty reply, a connection reset after the request, headers that are invalid or too large, or a protocol violation. It is a catch-all for origin-side misbehaviour.

What typically causes a 520

  • The origin crashed or reset the connection while handling the request.
  • Response headers exceeding Cloudflare's size limits (often many or huge Set-Cookie headers).
  • An origin firewall or security module resetting Cloudflare connections mid-request.
  • Empty responses from misconfigured applications (no status line).

Fix it on the server

  • Check origin logs for the Cloudflare Ray ID time; reproduce by requesting the origin directly (curl --resolve example.com:443:<origin-ip>).
  • Make sure Cloudflare IP ranges are allowed and not rate-limited by the origin firewall.

Fix it as a client or visitor

  • Retry; if it persists only the site owner can fix it. Quote the Ray ID from the error page.

Headers that go with 520

HeaderRole
CF-RAYRequest ID to give to the site owner or Cloudflare support.

Example response

HTTP/1.1 520
Server: cloudflare
CF-RAY: 8e1f2a3b4c5d6e7f-FRA
Content-Type: text/html

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.