Cloudflare Error Code 520, How to Fix Error Code 520 Cloudflare and What it is?

what is Cloudflare error code 520? we will explain completely why error code 520 Cloudflare occurs, and provide some solutions to fix the error and get your website up and running again.

by Suganya

Updated Sep 11, 2023

Advertisement
Cloudflare Error Code 520, How to Fix Error Code 520 Cloudflare and What it is?
fresherslive

Cloudflare Wiki

Cloudflare, Inc. is a San Francisco-based company that offers content delivery network services, cloud cybersecurity, ICANN-accredited domain registration, and DDoS mitigation. As of 2022, it is used by more than 20% of the entire Internet for web security services. Cloudflare was founded in 2009 by Matthew Prince, Lee Holloway, and Michelle Zatlyn, who had previously worked together on a similar project.

Article continues below advertisement

The company has been venture-capital funded since its inception and went public on the New York Stock Exchange in September 2019. In 2020, Michelle Zatlyn was named president, becoming one of the few women to hold such a position in a publicly traded technology company in the U.S. Cloudflare has acquired several web-services and security companies over the years.

Since at least 2017, the company has been using a wall of lava lamps in their San Francisco office as a source of randomness for encryption keys. The lava lamp installation implements the Lavarand method, where a camera captures the random shapes of the blobs and transforms them into a digital image.

What is Cloudflare Error Code 520?

Error 520 from Cloudflare is a challenging error code because it can have multiple causes leading to a webpage being inaccessible. To efficiently troubleshoot the issue, it's crucial to understand the potential reasons behind it. Essentially, the Cloudflare Error Code 520 message indicates that the origin web server received an inadequate or misinterpreted request, resulting in an empty response.

When attempting to access a website, visitors may encounter an error message labeled as "Error 520: Web Server Is Returning an Unknown Error." This error message is a generic response from Cloudflare, indicating that something unexpected occurred while trying to access the website, resulting in an empty response. This error can be caused by a variety of factors, including improper web server configuration or an invalid HTTP response.

Causes for Error Code 520 Cloudflare

  1. PHP applications may crash, causing website visitors to encounter errors.
  2. Incorrectly configured DNS records can also lead to errors when trying to access a website.
  3. A corrupt or improperly configured .htaccess file can cause website issues.
  4. Large request headers and excessive cookie usage can result in errors for website visitors.
  5. Missing request headers may prevent website content from loading properly.
  6. An empty response from the server can also cause errors when attempting to access a website.

How to Fix Cloudflare Error Code 520?

Step 1: Pause Cloudflare

If the issue is caused by Cloudflare, temporarily pausing it can make the affected website accessible again. To pause Cloudflare, log in to your account, go to the Overview tab, scroll down to the Advanced Actions section, and select "Pause Cloudflare on Site."

Step 2: Check DNS Records

Make sure that the DNS records in Cloudflare match the ones in the domain's DNS management system. To access Cloudflare's DNS records, log in to your account, select the website that's producing the error, and go to DNS > Records in the left-hand menu.

Step 3: Restart PHP

If the error is due to a PHP application crash, restarting the web server hosting the website may resolve the issue. The steps to restart PHP depend on your software stack and operating system. Below are instructions for restarting an Apache or Nginx server on different operating systems.

Step 4: Check Headers and Cookies

The "Error 520" message can also be triggered by exceeding the maximum allowed size of Cloudflare's request headers, which is 32 KB (16 KB per header). You can check the size of the request headers in the origin server's HTTP Archive (HAR) file.

Article continues below advertisement
  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."


Disclaimer: The above information is for general informational purposes only. All information on the Site is provided in good faith, however we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information on the Site.

What is Cloudflare Error Code 520 - FAQs

1. What is "Error 520: Web Server Is Returning an Unknown Error"?

"Error 520" is a generic response issued by Cloudflare to indicate that your website did something unexpected, resulting in an empty response. It can be caused by a variety of factors, including improperly configured web servers, invalid HTTP responses, and more.

2. How can I troubleshoot "Error 520"?

Pause Cloudflare,Check DNS records,Restart PHP,Check headers and cookies

3. How do I pause Cloudflare?

To pause Cloudflare, log in to your account, go to the Overview tab, scroll down to the Advanced Actions section, and select "Pause Cloudflare on Site."

4. How can I check the size of request headers?

You can check the size of the request headers in the origin server's HTTP Archive (HAR) file. To generate and extract a HAR file in Google Chrome, follow the steps outlined in the previous answer.

Advertisement