Cloudflare Error 520: Web Server Returned an Unknown Error
Quick answer
Error 520 means the origin sent an empty or unexpected response. Check origin crashes, oversized headers and cookies, HTTP/2 settings and firewall blocks.
Most likely fix: Rule out Cloudflare quickly
How to fix it
Try these in order — the most common fix is first.
1. Rule out Cloudflare quickly
- Set the DNS record to DNS only or pause Cloudflare
- If the site works, the origin response is the problem
Did this fix it?2. Check the origin logs
- Look for crashes, PHP fatal errors and blocked requests
- Allowlist Cloudflare IP ranges
Did this fix it?3. Clear oversized headers
- Clear cookies for the site and retry
- Reduce cookie size or count in the app
Did this fix it?4. Check HTTP/2 to origin
- Go to Speed > Settings > Protocol Optimization
- Disable HTTP/2 to Origin and retest
Did this fix it?5. Contact support with evidence
- Include URLs, cf-ray, output of /cdn-cgi/trace and two HAR files (with and without Cloudflare)
Did this fix it?
Symptoms
'Error 520: Web server returned an unknown error' while the origin may work when Cloudflare is paused.
Why it happens
- Origin crash or PHP application misbehaving
- Firewall or security plugin blocking Cloudflare IPs
- Request headers larger than 128 KB (too many cookies)
- Empty or malformed responses
- Incorrect HTTP/2 setup at the origin
- Authenticated Origin Pull not matched at the origin
This guide also covers
- cloudflare error 520
- web server returned an unknown error
- 520 error cloudflare nginx
Still not working?
If Cloudflare keeps failing, you're not alone. See every Cloudflare problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther Cloudflare errors
- Cloudflare Error 521: Web Server Is Down
- Cloudflare Error 522: Connection Timed Out
- Cloudflare Error 524: A Timeout Occurred
- Cloudflare Error 525: SSL Handshake Failed
- Cloudflare Error 526: Invalid SSL Certificate
- Cloudflare Error 1020: Access Denied
- Cloudflare Error 1015: You Are Being Rate Limited
- Cloudflare Error 1016: Origin DNS Error