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
- 1Check origin server logs (Apache/nginx error log) for crashes or errors at the time of the 520
- 2Whitelist all Cloudflare IP ranges on the origin server firewall (cloudflare.com/ips)
- 3Reduce response header size if exceeding 32 KB (large Set-Cookie headers are common)
- 4Test origin directly (bypass Cloudflare) to see if the server responds correctly
- 5Check if the origin application is crashing: PHP, Node, Python error logs
Tags
http520cloudflareorigin-errorcdn
More in 5xx Server Error
http-500-internal-server-errorHTTP 500 Internal Server Error — What It Means & How to Fix It
Criticalhttp-501-not-implementedHTTP 501 Not Implemented — What It Means & How to Fix It
Criticalhttp-502-bad-gatewayHTTP 502 Bad Gateway — What It Means & How to Fix It
Criticalhttp-503-service-unavailableHTTP 503 Service Unavailable — What It Means & How to Fix It
Criticalhttp-504-gateway-timeoutHTTP 504 Gateway Timeout — What It Means & How to Fix It
Criticalhttp-505-http-version-not-supportedHTTP 505 HTTP Version Not Supported — What It Means & How to Fix It
CriticalFrequently Asked Questions
Almost always your origin server. 520 means Cloudflare connected to your server but received an invalid or empty response.