Skip to content
Webmaster Tools

520 Web Server Returned an Unknown Error

What Cloudflare error 520 (web server returned an unknown error) means, the origin problems that cause it, how to debug by bypassing Cloudflare, and how it affects SEO.

All status codes

What 520 means

520 is not a standard HTTP status code. Cloudflare sends it, from its edge, when the origin server returned something it couldn't use: an empty, unknown or unexpected response. It's Cloudflare's catch-all for "the connection to the origin worked, but what came back wasn't a valid HTTP answer". Your own server never sent 520; Cloudflare generated it on your server's behalf.

HTTP/2 520
server: cloudflare
cf-ray: 8c1f2a3b4d5e6f70-AMS
content-type: text/html

<title>example.com | 520: Web server is returning an unknown error</title>

The cf-ray ID identifies the request in Cloudflare's logs and is what Cloudflare support asks for.

Common causes

The usual causes:

  • The origin crashed or reset the connection after accepting it, for example a PHP or application process dying mid-request.
  • An empty response: no status line and no headers.
  • Response headers too large, typically from too many or very large cookies.
  • Invalid HTTP: a missing status code or malformed headers from a custom or misconfigured server.
  • A firewall or security module (fail2ban, mod_security, a host-level DDoS filter) that cuts Cloudflare's connections because many requests come from few IPs.
  • HTTP/2 to the origin misbehaving, when origin HTTP/2 is enabled.

How to fix it

  1. Read the origin's logs at the time of the error: the web server's error log and the application log. Search for the URL and the minute shown on the error page.

  2. Bypass Cloudflare to test the origin. Send the request straight to the origin IP with the host name you expect:

    curl -svo /dev/null --resolve example.com:443:203.0.113.10 https://example.com/
    

    If this also fails or returns nothing, the problem is on the origin, not at Cloudflare.

  3. Allowlist Cloudflare's IP ranges (published at cloudflare.com/ips) in the server firewall, fail2ban and any rate limiter, and restore real visitor IPs with mod_remoteip or nginx's real_ip_header CF-Connecting-IP so blocks target visitors, not Cloudflare.

  4. Shrink the headers: cut down cookies and long custom headers if the response headers are large.

  5. If origin HTTP/2 is enabled and the errors started with it, turn it off to test.

  6. If the origin looks healthy, open a ticket with Cloudflare including the cf-ray IDs and a HAR file.

520 and SEO

Googlebot sees the 520 status, which is in the 5xx range, so it's handled like any server error: crawling slows down while errors continue, and URLs that fail for a long time are eventually dropped from the index. Intermittent 520s under load are easy to miss in a browser; Search Console's crawl stats report shows them as server errors.

Check what visitors get from the edge with the Redirect Checker, or inspect the full response headers with the HTTP Request Builder.