HTTP 520 — Web Server Returned an Unknown Error
HTTP 520
Web Server Returned an Unknown Error
Cloudflare reached the origin server but got back a response it could not make sense of.
What 520 actually means
This is not a standard HTTP status code — it is Cloudflare's, and it appears only on sites behind Cloudflare. It is the catch-all for "the origin answered, but with something empty, malformed or otherwise unexpected": a connection reset mid-response, headers that are too large, or a reply that is not valid HTTP. Because it is a catch-all, 520 is the least specific of Cloudflare's errors and usually needs the origin logs to resolve.
Common causes
- The origin server reset the TCP connection mid-response
- The origin returned an empty response
- Response headers exceeding Cloudflare's size limit, often from too many cookies
- A malformed response that is not valid HTTP
- The origin's application crashing part-way through generating a response
- A firewall at the origin dropping Cloudflare's connections inconsistently
If you're just trying to view the page
- Reload after a moment — 520s are often intermittent
- Nothing else on your side; this is between Cloudflare and the site's own server
- Report it to the site owner, including the Cloudflare Ray ID shown on the error page
If it's your site
- Check the origin's error logs at the timestamp on the error page; the Ray ID lets you correlate exactly
- Reduce response header size — a large number of cookies is the most common trigger
- Confirm the origin is not resetting connections; look for crashes or `RST` packets in a `tcpdump`
- Whitelist Cloudflare's published IP ranges at the origin firewall
- Bypass Cloudflare temporarily (test against the origin IP directly) to confirm whether the origin is at fault
Reference
- Status code
- 520
- Reason phrase
- Web Server Returned an Unknown Error
- Category
- 5xx — Server Error
- Cacheable by default
- No
Common questions
- What does HTTP 520 mean?
- Cloudflare reached the origin server but got back a response it could not make sense of. This is not a standard HTTP status code — it is Cloudflare's, and it appears only on sites behind Cloudflare. It is the catch-all for "the origin answered, but with something empty, malformed or otherwise unexpected": a connection reset mid-response, headers that are too large, or a reply that is not valid HTTP.
- How do I fix a 520 error?
- Reload after a moment — 520s are often intermittent
- Is 520 a client error or a server error?
- 520 is in the 5xx range, which means server error. The request was acceptable but the server could not fulfil it, so retrying later can succeed.
Related pages
- 500 Internal Server Error Something went wrong on the server and it has no more specific code to describe
- 502 Bad Gateway A proxy or gateway reached the server behind it and got back a broken response,
- 503 Service Unavailable The server is temporarily unable to handle the request, usually because it is ov
- 504 Gateway Timeout A proxy or gateway waited for the server behind it and gave up before an answer
- 524 A Timeout Occurred Cloudflare connected to the origin successfully but the origin did not finish re
- 521 Web Server Is Down Cloudflare could not connect to the origin server because it refused the connect
- 522 Connection Timed Out Cloudflare tried to open a connection to the origin server and never got a reply
- 525 SSL Handshake Failed The TLS handshake between Cloudflare and the origin server failed.
- 526 Invalid SSL Certificate The origin server presented a TLS certificate that Cloudflare could not validate
- 530 Origin DNS Error A Cloudflare error shown alongside a 1xxx error code that carries the real expla
- 501 Not Implemented The server does not support the functionality needed to fulfil the request, usua
- 511 Network Authentication Required You need to log in to the network itself — this is a captive portal, not the sit