Error
Try the suggestions in this Community Tip to help you fix “Error 520: Web server is returning an unknown error”.
Background
Error 520 is essentially a catch-all response when something unexpected happens or when the origin server incorrectly interprets or does not tolerate a request due to a protocol violation or an empty response. A 520 error occurs when the connection started on the origin web server, but that the request was not completed. The most common reason why this would occur is that either a program, cron job, or resource is taking up more resources than it should causing the server not to be able to respond to all requests properly. When this happens, you’ll see “Error 520: Web server is returning an unknown error”.
Quick Fix Ideas
-
Your web server or networking equipment, any http aware device like Firewall, Load Balancer, et al, reset the TCP connection after it was established. Sometimes when a web server crashes it will reset the connection. Check your web server error logs with your hosting provider for the time that the error occurred to see any error messages.
-
Your web server returned an invalid response that exceeded our limits. Often this can happen if your web server is returning too many/too large headers. This is often caused by runaway scripts that return too many cookies, for example. The Code Igniter PHP framework has some known bugs around this, too.
-
While you’re having a conversation with your hosting provider, make sure they include Cloudflare IPs on their allowed list.
-
While the 520 error can be triggered by unique and seemingly strange edge-case scenarios, they are generally caused by: Connection resets (following a successful TCP handshake), Headers exceed the Cloudflare header size limit (over 8kb), An empty response from origin, An invalid HTTP response, Missing response headers from an HTTP response, or the Presence of multiple Content-Length headers.
-
Note that if Always Online is enabled, this error will trigger an Always Online page to be served. Disable Always Online and check to see if the error goes away or changes. If so, consult the appropriate 521 or 522 #CommunityTip.
-
If this error is still happening, post on this site and provide example URL(s) and Ray ID and output from a traceroute from any impacted user, copy the output of
example.com/cdn-cgi/trace
- replaceexample.com
with the affect domain. Also prepare two HAR file(s): one detailing your request with Cloudflare enabled on your website and the other with Cloudflare temporarily disabled - see How do I temporarily deactivate Cloudflare? If Cloudflare Support needs to assist, these HAR files will be helpful in comparing server responses.
Lite Reading
https://support.cloudflare.com/hc/en-us/articles/115003011431#520error
Background Resources
Help Center
YouTube
Research The Issue
Google
If You Need More Help
This community of other Cloudflare users may be able to assist you, login to Cloudflare and post your question to the Community. When you post on the Community make sure to include as much of this information as possible: the specific error message you are seeing, the URLs this is happening on, screen shot of the error, and the steps to reproduce the error. Please indicate what troubleshooting steps you’ve tried in order to help us help you.
This is a Cloudflare Community Tip, to review other tips click here.
Çevirme…traduzir…翻译…traducir…Traduire…Übersetzen… Translate this Tip
FXWSCT 101819