At One Place

HTTP 520 — Web Server Returned an Unknown Error

HTTP 520
Web Server Returned an Unknown Error
Cloudflare reached the origin server but got back a response it could not make sense of.

What 520 actually means

This is not a standard HTTP status code — it is Cloudflare's, and it appears only on sites behind Cloudflare. It is the catch-all for "the origin answered, but with something empty, malformed or otherwise unexpected": a connection reset mid-response, headers that are too large, or a reply that is not valid HTTP. Because it is a catch-all, 520 is the least specific of Cloudflare's errors and usually needs the origin logs to resolve.

Common causes

  • The origin server reset the TCP connection mid-response
  • The origin returned an empty response
  • Response headers exceeding Cloudflare's size limit, often from too many cookies
  • A malformed response that is not valid HTTP
  • The origin's application crashing part-way through generating a response
  • A firewall at the origin dropping Cloudflare's connections inconsistently

If you're just trying to view the page

  1. Reload after a moment — 520s are often intermittent
  2. Nothing else on your side; this is between Cloudflare and the site's own server
  3. Report it to the site owner, including the Cloudflare Ray ID shown on the error page

If it's your site

  1. Check the origin's error logs at the timestamp on the error page; the Ray ID lets you correlate exactly
  2. Reduce response header size — a large number of cookies is the most common trigger
  3. Confirm the origin is not resetting connections; look for crashes or `RST` packets in a `tcpdump`
  4. Whitelist Cloudflare's published IP ranges at the origin firewall
  5. Bypass Cloudflare temporarily (test against the origin IP directly) to confirm whether the origin is at fault

Reference

Status code
520
Reason phrase
Web Server Returned an Unknown Error
Category
5xx — Server Error
Cacheable by default
No

Common questions

What does HTTP 520 mean?
Cloudflare reached the origin server but got back a response it could not make sense of. This is not a standard HTTP status code — it is Cloudflare's, and it appears only on sites behind Cloudflare. It is the catch-all for "the origin answered, but with something empty, malformed or otherwise unexpected": a connection reset mid-response, headers that are too large, or a reply that is not valid HTTP.
How do I fix a 520 error?
Reload after a moment — 520s are often intermittent
Is 520 a client error or a server error?
520 is in the 5xx range, which means server error. The request was acceptable but the server could not fulfil it, so retrying later can succeed.

Related pages

Sources

  1. Hypertext Transfer Protocol (HTTP) Status Code Registry — IANA
  2. RFC 9110: HTTP Semantics — IETF

How these figures are compiled and checked