Error Codes Wiki

HTTP 520 Cloudflare — Web Server Returned an Unknown Error

Error5xx server error

Overview

Cloudflare error 520 means the origin web server returned an unexpected or empty response that Cloudflare could not process.

Key Details

  • 520 is a Cloudflare-specific status code, not part of standard HTTP
  • Cloudflare received a connection but got an invalid or empty response
  • The origin server established TCP connection but sent no HTTP response
  • Common with misconfigured origin servers or applications crashing on request
  • Different from 522 (connection timeout) and 524 (timeout on response)

Common Causes

  • Origin server crashed or sent a malformed response
  • Origin server PHP/application error returning empty response
  • Cloudflare IP addresses not whitelisted on origin server firewall
  • Response headers from origin exceed Cloudflare's 32 KB header buffer
  • Origin server closing the connection before sending a complete response

Steps

  1. 1Check origin server logs (Apache/nginx error log) for crashes or errors at the time of the 520
  2. 2Whitelist all Cloudflare IP ranges on the origin server firewall (cloudflare.com/ips)
  3. 3Reduce response header size if exceeding 32 KB (large Set-Cookie headers are common)
  4. 4Test origin directly (bypass Cloudflare) to see if the server responds correctly
  5. 5Check if the origin application is crashing: PHP, Node, Python error logs

Tags

http520cloudflareorigin-errorcdn

More in 5xx Server Error

Frequently Asked Questions

Almost always your origin server. 520 means Cloudflare connected to your server but received an invalid or empty response.