520 Web Server Is Returning an Unknown Error
The HTTP 520 Web Server Is Returning an Unknown Error status code is an unofficial server error specific to Cloudflare. This catch-all error appears when the origin server sends an empty, unknown, or unexpected response.
Usage
Cloudflare is a content delivery network acting as a reverse proxy between clients and origin servers. The 520 error indicates the origin server returned something Cloudflare was unable to interpret. Common triggers include:
- The origin server sent an empty response with no status code or headers.
- The origin server closed the connection before sending a complete HTTP response.
- The response exceeded Cloudflare's header size limits (over 128 KB of response headers).
- The origin server sent a malformed or invalid HTTP response.
Note
A 520 error does not always mean the origin is down. The origin server is reachable and accepting connections, but the response is not valid HTTP.
SEO impact
Search engines treat Cloudflare 520 responses as server errors. Persistent 520 responses reduce crawl rate and prevent indexing of affected URLs. Resolving the underlying origin server issue restores normal crawling.
Troubleshooting steps focus on the origin server itself. Reviewing origin server logs, checking for resource exhaustion, and verifying the web server configuration are typical first actions.
Example
A client sends a standard GET request through Cloudflare. The origin server returns an empty or malformed response, prompting Cloudflare to respond with a 520 error page.
Request
GET /api/data HTTP/1.1
Host: www.example.re
Accept: application/json
Response
HTTP/1.1 520 Web Server Is Returning an Unknown Error
Date: Sun, 02 Mar 2026 10:15:00 GMT
Content-Type: text/html
Server: cloudflare
CF-RAY: 8a1b2c3d4e5f6-SJC
<html>
<head><title>520 Origin Error</title></head>
<body>
<h1>Error 520</h1>
<p>Web server is returning an unknown error</p>
</body>
</html>
How to fix
Start with the origin server error logs. Look for application crashes, PHP fatal errors, or resource exhaustion at the timestamps matching the 520 errors. A common trigger is a PHP process crash returning an empty response body with no HTTP status line.
Verify the origin returns valid HTTP responses with a complete status line and well-formed headers. Response headers exceeding 128 KB (often caused by excessive cookies or debug headers) trigger a 520. Strip unnecessary Set-Cookie or custom headers to stay within the limit.
Check whether the origin firewall or hosting provider
blocks Cloudflare IP ranges. Allowlist all addresses
listed at cloudflare.com/ips in iptables, .htaccess,
or the hosting control panel.
Disable HTTP/2 to Origin in the Cloudflare dashboard under Speed > Settings > Protocol Optimization if the origin web server does not fully support HTTP/2 via ALPN. Misconfigured HTTP/2 on the origin is a frequent source of malformed responses.
To isolate the problem, temporarily set the affected DNS record to DNS-only (grey cloud) in Cloudflare. If the site loads without errors, the issue lies between Cloudflare and the origin rather than the origin itself.
Note the CF-RAY header value from the error response.
Provide the Ray ID and the output of
http://<domain>/cdn-cgi/trace when escalating to
Cloudflare support.
Takeaway
The 520 Web Server Is Returning an Unknown Error status code is a Cloudflare-specific error generated when the origin server sends an empty, malformed, or otherwise uninterpretable response.
See also
- 521 Web Server Is Down
- 522 Connection Timed Out
- 523 Origin Is Unreachable
- 524 A Timeout Occurred
- Troubleshooting Cloudflare Errors
- HTTP status codes