Cloudflare Error Code 520, How to Fix Error Code 520 Cloudflare and What it is?
by Suganya
Updated Sep 11, 2023
![Cloudflare Error Code 520, How to Fix Error Code 520 Cloudflare and What it is? Cloudflare Error Code 520, How to Fix Error Code 520 Cloudflare and What it is?](https://img20.fresherslive.com/latestnews/2023/05/what-is-cloudflare-error-code-520-how-to-fix-it-6451fa8c2df2114842458-900.webp)
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.
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
- PHP applications may crash, causing website visitors to encounter errors.
- Incorrectly configured DNS records can also lead to errors when trying to access a website.
- A corrupt or improperly configured .htaccess file can cause website issues.
- Large request headers and excessive cookie usage can result in errors for website visitors.
- Missing request headers may prevent website content from loading properly.
- 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.
- Open the web page that's producing the 520 error.
- Right-click and select "Inspect."
- Select the "Network" tab.
- Check the "Preserve log" option.
- Click the "Clear" (stop sign) button.
- Reload the page.
- Right-click anywhere below the navigation bars in the inspect tool.
- Select "Save all as HAR with content."
What is Cloudflare Error Code 520 - FAQs
"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.
Pause Cloudflare,Check DNS records,Restart PHP,Check headers and cookies
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."
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.