How to Fix Cloudflare 520 Error Message

You must make sure that your website functions properly at all times if you own it. However, when users attempt to access its content, they might encounter the error message “Error 520: Web Server Is Returning an Unknown Error.”

It’s a blanket response provided by Cloudflare that says something unexpected happened on your website and left it with an empty response. It could be caused by a number of things, including the configuration of the web server or an invalid HTTP response.

This article will go over a number of potential causes for this Cloudflare error variation. Here are steps to fix this error message.

Why Error 520 Cloudflare?

The web server receives an invalid or improperly interpreted request, which results in an empty response and the Cloudflare error 520. As a result, the message “Web server is returning an unknown error” appears on the accessed website.

The following are several common reasons why this error occurred:

  • Crash at the origin web server. The origin server may be running a script that uses a lot of resources, or it may have misinterpreted requests. As a result, the server cannot fulfill these requests.
  • The origin server doesn’t allow connections with any Cloudflare IP addresses. Non-whitelisted IP addresses might be blocked by your firewall’s settings. Verify that the IP address for Cloudflare is not one of them.
  • Short idle timeouts. Client and server can communicate with each other by establishing a connection using the TCP (Transmission Control Protocol). The idle timeout value for a web server is 300 seconds by default. Therefore, the 520 error can occur when the TCP timeout value is less than 300 seconds.
  • Cloudflare-incompatible response headers. A web server and a client can communicate thanks to HTTP headers. They include information like the client browser, the requested page, and cookies. For instance, if there are too many cookies, the header size will increase. It will result in response headers that are invalid or missing if it goes over Cloudflare’s 16 KB request header size limit.

How to Fix Error 520 Cloudflare

Let’s look at solutions now that you are aware of the possible causes of the Cloudflare 520 Error.

1. Ensure Cloudflare DNS Records are Correct

When it comes to a website’s efficient operation, DNS records are crucial because they reveal details like which IP address goes with which domain name.

An empty or unexpected response from the origin web server may result from incorrect DNS records. To find your domain’s IP address, open the DNS zone editor for your domain. To confirm that your DNS records are configured correctly, sign in to your Cloudflare dashboard next.

2. Check Headers and Cookies

Request headers from Cloudflare are limited in size overall to 32 KB and individually to 16 KB. The 520 error response could appear if the headers go over the allowed number. Review the site’s headers and cookies by gaining access to your server’s HAR (HTTP Archive).

All web browser requests are essentially recorded in HAR files, along with request and response headers, body text, and page load times. You can identify the root cause of the error and find a fix by creating HAR files.

Using Google Chrome, follow these steps to create a HAR file:

1. Right click the web page where the error 520 is displayed and click on Inspect to open the developer tools.

2. Click on the Network tab.

3. Click on the small round button if it’s gray.

4. Check the Preserve log box.

Open the network tab once more and refresh the page.

  1. Right click anywhere on the developer tools window.
  2. Select Save all as HAR with Content.
  3. To examine the file, use an online tool such as Google’s HAR Analyzer.

Consider using a cookie-free domain if you discover that overusing cookies or using cookies that are too large are to blame for the error 520.

3. Investigate Error Logs

Most error messages don’t provide much guidance on how to fix them. Error logs are therefore available to assist in locating their cause and expediting troubleshooting. Depending on where your website is hosted, different locations have error logs.

The error_log file contains details about the error, including the time and kind of error that occurred. Additionally, it specifies which files and lines need fixing.

If you host your website with ASPHostPortal, you can ask our support team to enable error message for you on the server or you can ask our support team to check it directly on the server.

4. Disable Cloudflare

By logging into your Cloudflare dashboard and selecting the DNS tab, you can disable Cloudflare. After selecting a domain, switch the Proxy status button.

As an alternative, briefly pause Cloudflare. Stopping your account prevents traffic from passing through Cloudflare’s network and revealing your origin server’s IP address.

  1. Log into your Cloudflare account and go to the dashboard’s Overview tab.
  2. Scroll down until you see Advanced Actions.
  3. Click Pause Cloudflare on Site and confirm the request.

Remember that stopping Cloudflare turns off its security and protection functions. So as to avoid caching, Cloudflare advises switching to Development Mode. You can view real-time updates to your origin server thanks to it.

Log into your Cloudflare dashboard and select the Caching tab. Scroll down the page after selecting Configuration until you see the toggle icon for the Development Mode.

5. Contact Cloudflare customer support

Send a support ticket to the Cloudflare support staff if you require additional help. Usually, you’ll need to send the URL details, the Cloudflare Ray ID, and the HAR files showing the times when Cloudflare was temporarily enabled and disabled.

Conclusion

The error 520: web server is returning an unknown error may have an impact on user experience as well as your ability to access the dashboard for your website.

As a result, you must immediately figure out how to fix it. We provided seven solutions to resolve an error 520 in this article:

  1. Ensure Cloudflare DNS records are correct.
  2. Check headers and cookies.
  3. Investigate error logs.
  4. Disable Cloudflare.
  5. Contact Cloudflare support.

This article should assist you in fixing the Cloudflare 520 error response. Please feel free to ask any additional questions in the comments section below.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *