Do you get the “Error 520: web server returns an unknown error” when using Cloudflare with your (staging) website?
The error 520 appears when the origin server returns an empty, unknown, or unexpected response to Cloudflare.
A quick workaround while further investigating the reason for the 520 error is to either make the record DNS-only in the Cloudflare DNS app or temporarily pause Cloudflare.
Contact your hosting provider or site administrator and request a review of your web server error logs for crashes and fatal errors and check for common reasons:
- Origin web server application crashes
- Cloudflare IPs are not allowed at your origin
- Headers exceeding 16 KB (typically due to too many cookies)
- An empty response from the origin web server that lacks an HTTP status code or response body
- Missing response headers or origin web server not returning proper HTTP error responses.
- Upstream prematurely closed connection while reading response header from upstream is a common error you may see in your Cloudflare logs. This indicates the origin web server had issues that caused Cloudflare to generate 520 errors.
520 errors are prevalent with certain PHP applications that crash the origin web server.
If 520 errors continue after contacting your hosting provider or site administrator, provide the following information to Cloudflare Support:
- Full URL(s) of the resource requested when the error occurred
- Cloudflare cf-ray from the 520 error message
- Output from http://www.example.com/cdn-cgi/trace (replace www.example.com with your hostname and domain where the 520 error occurred)
- Two HAR files:
one with Cloudflare enabled on your website, and
the other with Cloudflare temporarily disabled.