520 Unofficial (Cloudflare) πŸ“‹

520 Unknown Error: The Cloudflare Catch-All

Last updated: June 28, 2026 β€’ 4 min read

✦ The Golden Answer: The 520 Unknown Error is a Cloudflare-specific status code. It indicates that the origin server (your web server) returned an empty, unknown, or unexpected response that Cloudflare could not interpret. This is essentially a catch-all for any kind of unexpected response from the origin β€” it could be a blank page, a malformed response, or a server crash that doesn't produce a valid HTTP response.

Common Causes of 520 Errors

CauseExampleHow to Fix
Application crashPHP or Node.js process crashes and returns nothing.Check application logs for fatal errors; fix the code or restart the process.
Memory exhaustionServer runs out of memory and cannot produce a response.Increase memory limits, optimize code, or add more RAM.
Malformed HTTP responseOrigin server returns a response with invalid headers or status.Check the origin server's response headers; ensure they are correctly formatted.
Empty responseOrigin server sends no data (e.g., 0-byte response).Check the application logic to ensure it always outputs a valid response.
Firewall blockingA firewall or security group blocks Cloudflare's IPs.Whitelist Cloudflare IP ranges in your firewall.

Example: Cloudflare Log Entry

In Cloudflare's logs, a 520 error indicates that the origin returned an unexpected response. The exact error message may vary.

HTTP/1.1 520 Unknown Error Date: Sun, 28 Jun 2026 10:15:23 GMT Content-Type: text/html <html> <body> <h1>520 Unknown Error</h1> <p>The origin server returned an unexpected response.</p> </body> </html>

How to Fix 520 Errors

  • Check origin server logs: Look for application errors (e.g., PHP fatal errors, uncaught exceptions, out‑of‑memory errors).
  • Test directly: Bypass Cloudflare by accessing your origin server directly (e.g., using the server's IP or a hosts file entry). This will show you the raw response.
  • Ensure proper responses: Your origin server must return a complete HTTP response (status line, headers, body). Even a simple error page is better than an empty response.
  • Whitelist Cloudflare IPs: Make sure your firewall allows requests from Cloudflare's IP ranges (available from Cloudflare's documentation).
  • Increase resources: If your application is crashing due to resource exhaustion, consider scaling up or optimizing the application.

Preventing 520 Errors

  • Implement monitoring: Use application monitoring (e.g., New Relic, Sentry) to detect crashes early.
  • Set up health checks: Regularly test your origin server to ensure it responds correctly.
  • Use a staging environment: Test code changes before deploying to production.
  • Enable detailed logging: Log all application errors to help diagnose issues.

Frequently Asked Questions

Is 520 a client error or a server error?

It is a server error (5xx) because the origin server failed to produce a valid response. Cloudflare is acting as a proxy and cannot interpret the origin's response.

Can I fix a 520 error from the client side?

No, it is a server-side issue. Only the website owner or server administrator can fix it.

What is the difference between 520 and 521?

520 means the origin returned an unexpected response (empty or malformed). 521 means the origin server is completely unreachable (connection refused).