Cloudflare Error Code 520: Web Server is Returning An Unknown Error!

Error 520 is a server-side error caused by a problem with the connection between the web server and the origin server.

To avoid this error, try refreshing the page, clearing your browser cache and cookies, contacting your hosting provider or website administrator, and checking your server’s logs for any difficulties.

While analyzing the cause of the 520 problems, one simple remedy is to either make the record DNS-only in the Cloudflare DNS app or temporarily pause Cloudflare.

This will assist in evaluating whether the problem is with Cloudflare or the origin server. In this article, we’ll learn more about Cloudflare error code 520, how to fix it, and the causes of error code 520.

What is Error 520?

The Cloudflare 520 error is a typical mistake that results in an empty or unexpected response to the source server. This is especially true when a resource-intensive procedure hinders the server from responding quickly.

Cloudflare Error Code 520

There are several additional 5XX problems, including the 502 bad gateway error, although they are very different in many aspects.

Look at the tweet posted by the Offical account of Boxuga:-

Causes for Error Code 520 Cloudflare

1. Application Crashes

If the application that delivers Cloudflare’s requests on your origin server crashes, you may receive the error 520, as illustrated here:

If you’re using WordPress, this could signify that your application crashed for a variety of reasons, including misconfigured plugins, a faulty update, or even a server problem. Checking the debug logs in WordPress is the easiest technique to figure out what happened. Refer to the unique debugging mechanisms for non-WordPress applications.

It’s a good idea to have a mechanism in place to collect debug information before something goes wrong on your website. You don’t have to keep the data indefinitely; just a few days would suffice. However, it will help you to delve into your application data and figure out what went wrong so you can correct it.

2. Cloudflare IPs Blocked by your Firewall

Because Cloudflare sits between your users and your origin, the server must permit Cloudflare IPs to connect to it hundreds of times per day.

Most servers aren’t affected by this, however, if you have a specific configuration, it may be preventing Cloudflare’s servers from connecting. This has become more common since Cloudflare reduced its support for cPanel integration.

Without the in-built integration on most web hosts, Cloudflare is simply just another external source that connects to your server. If you receive a 520 error, check to see if your server’s firewall is blocking it. If you need a reference, here’s an updated list of all Cloudflare IPs.

3. Domain Sets too Many Cookies

Although it is not clearly stated in the standard literature, Cloudflare appears to have a problem with response headers that are longer than 16 KB.

The closest source I could locate was Cloudflare’s guidance on Worker limits, which said that each header should be less than this limit.

The existence of too many cookies is the primary cause of this increased header size. Not that all of the cookies would take up 16 KB.

Many browsers and network devices, by default, limit the total number of cookies on any given request to roughly 4 KB. However, if other parts are bloating the size of your response header, your cookies may cause the entire size to exceed the limit.

This problem can be difficult to troubleshoot because your site may not set the same number of cookies on each request. Cookies do not need to be sent again once they are saved on the visitor’s computer. If you can’t figure out what’s wrong, check your cookies to see if that’s the issue.

4. Weird Error Responses from the Origin Server

Some PHP applications can cause the server to react with unexpected error messages. Here’s a list of all the standard HTTP response codes for your convenience. Cloudflare will give a 520 error if a plugin on your site creates a response code that does not belong on this list.

Cloudflare Error Code 520

How to Fix Cloudflare Error Code 520?

Step 1: Pause Cloudflare

If the problem is caused by Cloudflare, briefly halting it can restore access to the impacted website. Log in to your account, navigate to the Overview tab, scroll down to the Advanced Actions section, and pick “Pause Cloudflare on Site.”

Step 2: Check DNS Records

Check that the DNS records in Cloudflare correspond to those in the domain’s DNS management system. Log in to your account, choose the website that’s causing the error, and then navigate to DNS > Records in the left-hand menu.

Step 3: Restart PHP

If the error is caused by a PHP application crash, restarting the web server that hosts the website may help. The processes for restarting PHP vary according to your software stack and operating system. The methods for restarting an Apache or Nginx server on various operating systems are provided below.

Step 4: Check Headers and Cookies

The “Error 520” notice can also be produced by exceeding Cloudflare’s request header size limit of 32 KB (16 KB per header). The size of the request headers can be seen in the HTTP Archive (HAR) file of the origin server.

  1. Open the web page that’s producing the 520 error.
  2. Right-click and select “Inspect.”
  3. Select the “Network” tab.
  4. Check the “Preserve log” option.
  5. Click the “Clear” (stop sign) button.
  6. Reload the page.
  7. Right-click anywhere below the navigation bars in the inspect tool.
  8. Select “Save all as HAR with content.”

We will keep you updated with all the latest information until then stay tuned to our website

About The Author

Leave a Comment

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

Scroll to Top