520 Cloudflare Origin: Edge & web server Last updated 13 Oct 2026

Cloudflare Error 520: Web Server Returned an Unknown Error

Cloudflare connected to your origin, but the origin returned an empty, unknown or invalid response.

Exact message you may see Web server is returning an unknown error
Seen on: Cloudflare

Meaning

520 is Cloudflare’s catch-all for “the origin answered with something I can’t use” — the connection reset, the response was empty, or headers were invalid/too large. It’s an origin problem, not a Cloudflare outage.

Common causes

  • Origin application crashed mid-response
  • Response headers exceed Cloudflare’s 128 KB limit (huge cookies)
  • Empty response or connection reset by origin
  • Firewall on origin resetting connections from Cloudflare IPs
  • Invalid HTTP response from the application

⚡ Quick fix

  1. Check origin web server and app logs at the time of the Ray ID
  2. Temporarily pause Cloudflare (or hit origin IP directly) to reproduce
  3. Reduce cookie/header size
  4. Allow-list Cloudflare IP ranges in the origin firewall

Detailed fix by platform

Cloudflare

  1. Collect the Ray ID from the error page; compare timestamps with origin logs. Ensure the origin isn’t rate-limiting Cloudflare IPs.

Code examples

Bypass Cloudflare to test origin

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

Replace 203.0.113.10 with your origin IP.

How to diagnose

  1. Origin logs — Errors at the Ray ID timestamp?
  2. Direct request — Does origin respond correctly without Cloudflare?
  3. Headers — Response headers/cookies too large?
  4. Firewall — Cloudflare IPs allowed?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

1020 — Cloudflare Error 1020: Access Denied (Cloudflare)1020301 — HTTP 301 Moved Permanently (HTTP)301500 — HTTP 500 Internal Server Error (HTTP)500502 — HTTP 502 Bad Gateway (HTTP)502521 — Cloudflare Error 521: Web Server Is Down (Cloudflare)521522 — Cloudflare Error 522: Connection Timed Out (Cloudflare)522525 — Cloudflare Error 525: SSL Handshake Failed (Cloudflare)525526 — Cloudflare Error 526: Invalid SSL Certificate (Cloudflare)526520

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.