Cloudflare error 520

Updated 11 October 2026

Short answer

Error 520 means Cloudflare connected to your server, but what came back was empty, broken or not a valid web response. Your server or the app on it crashed mid-response, a security tool on your server cut Cloudflare off, or the response was malformed (for example, headers too large). Check your server's error log at the exact time of the 520.

What's the problem

Visitors see a Cloudflare page saying "Error 520: Web server is returning an unknown error". It may be constant or only on certain pages.

Why it happens

  • The app crashed while building the page, so the connection closed with nothing sent.
  • A firewall or security plugin on your server is blocking Cloudflare's IP addresses.
  • Response headers are too large, often because of very large cookies.
  • The server sent an invalid response, such as one with missing or malformed headers.

How to fix it

  1. Check your server's error logs at the time of the 520. A crash or reset will show there.
  2. Allow Cloudflare's IP addresses in your server firewall and any security plugin.
  3. Check the size of cookies and headers your site sends, and reduce them.
  4. Test your server directly, bypassing Cloudflare, to see the raw response. Your host can help with this.
  5. If it's one page, the code for that page is crashing. Look at that page's logs.

What Preventionlabs checks

One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; uptime checked every 5 minutes, with an email when the site goes down and when it is back. With Cloudflare connected, it also shows which pages returned server errors (5xx) to visitors, and when; your SSL mode and the other settings that commonly cause this; which requests the firewall blocked, by Cloudflare's own rule names; recent deploys and account changes, with their times; DNS changes in the last 7 days.

Run your free report

Your first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.

Sources

  1. Cloudflare: Error 520official docsThis error occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.
  2. Cloudflare: Error 520official docsFirewalls or security plugins blocking Cloudflare IPs ↗︎ at your origin.

Preventionlabs is independent and not affiliated with Cloudflare. Product names are used only to describe the problem.

← All of Cloudflare errors