Error 520: What It Means and How to Fix It

Introduction

Error 520 is an HTTP status code that indicates an unexpected condition occurred while the server was attempting to fulfill the request. It is a generic error code that is often used when no other more specific error code is available. This error can occur when a website is temporarily down or when there is a problem with the server configuration. Fortunately, there are a few steps you can take to try and fix this error. In this article, we will discuss what Error 520 means and how to fix it.

Error 520: What It Means and How to Fix It

Error 520 is an HTTP status code that indicates an issue with the origin web server. It is a generic error code that is used when no other specific code is suitable.

The most common cause of Error 520 is a misconfigured server or a problem with the origin web server. It can also be caused by a firewall or proxy server that is blocking access to the origin web server.

To fix Error 520, you should first check the origin web server for any misconfigurations or errors. If the issue is with the origin web server, you should contact the web server administrator to resolve the issue.

If the issue is with a firewall or proxy server, you should check the settings to make sure that the origin web server is not being blocked. If the issue is with a firewall or proxy server, you should contact the administrator of the firewall or proxy server to resolve the issue.
[ad_1]

Introduction

Cloudflare’s error 520 is a complex error code indicating that a webpage cannot be reached. The complexity of the issue lies in the variety of reasons that could have caused it.

Becoming familiar with potential causes is the key to streamlining the troubleshooting process.

This article explains what the error means, why it occurs, and how to troubleshoot and resolve it.

How to fix Error 520

What Is Error 520?

Error 520 is a Cloudflare error message indicating that the origin web server received an invalid or incorrectly interpreted request, resulting in an empty response. 

What Causes Error 520?

The most common causes for error 520 are:

  • PHP applications crashing.
  • Incorrectly configured DNS records.
  • Corrupt or incorrectly configured .htaccess file.
  • Large request headers and excessive cookie usage.
  • Missing request headers.
  • Empty response from server.

How to Troubleshoot and Fix Error 520

The following steps outline the process of investigating the cause behind Cloudflare’s error 520, so appropriate action can be taken accordingly.

Note: Before attempting the following methods, check that the affected website is completely inaccessible and that Cloudflare’s system status is “All Systems Operational”.

1. Pause Cloudflare

If the issue lies in Cloudflare, pausing it will make the page affected by the error accessible again. 

To pause Cloudflare: 

  1. Log in to your Cloudflare account. 
  2. Navigate to the Overview tab in the left-hand panel.
  3. Scroll down to the Advanced Actions section and select Pause Cloudflare on Site
How to pause Cloudflare to troubleshoot error 520.

2. Check DNS Records

Domain Name System (DNS) records are files in authoritative DNS servers that specify: 

  • What IP address is associated with a domain. 
  • How to handle incoming requests for that domain. 

For Cloudflare to work properly, Cloudflare DNS records must match the ones in the domain’s DNS management system. 

To locate Cloudflare’s DNS records for a website: 

  1. Log in to Cloudflare.
  2. Select the website that outputs the error 520.
  3. In the left-hand menu, select DNS > Records.
How to locate Cloudflare DNS records.

The exact steps to access a domain’s DNS settings depend on the website’s hosting platform. 

3. Restart PHP

Error 520 occurs also when a PHP application crashes. In that case, restarting the web server hosting the website fixes the issue. 

Depending on your software stack, PHP can be restarted in several ways. Below are instructions on how to restart an Apache or Nginx server on different operating systems.

Apache Web Server

To restart an Apache server running on an Ubuntu or Debian system, run:

sudo systemctl restart apache2

To restart an Apache server running on a CentOS 7 system, run:

sudo apachectl -k restart

Nginx Web Server

To restart an Nginx server gracefully, run:

sudo systemctl reload nginx

To force restart an Nginx server, run:

sudo systemctl restart nginx

Alternatively, to force close and restart Nginx and related processes, use:

sudo /etc/init.d/nginx restart

Some hosting platforms allow users to restart PHP using a graphical user interface (GUI). In that case, consult the hosting platform’s user manual or contact the customer support department. 

4. Check Headers and Cookies

The maximum allowed size of Cloudflare’s request headers is 32 KB, 16 KB per individual header. Exceeding these thresholds may cause the 520 error to occur. 

Information regarding the request headers’ size is available in the origin server’s HAR (HTTP Archive) file. 

To generate and extract a HAR file using Google Chrome:

  1. Open the web page displaying the 520 error.
  2. Right-click and select Inspect.
Inspect page to generate HAR file.
  1. Select the Network tab.
  2. Check the Preserve log option.
  3. Click the Clear (stop sign) button.
Setting up the Google Chrome browser to generate a HAR file
  1. Reload the page.
  2. Right-click anywhere in the area below the nav bars of the inspect tool.
  3. Select Save all as HAR with content.
How to save a HAR file.

The process of generating a HAR file is almost identical between different major web browsers since they are all built upon Chromium (except Firefox).

Examining HAR files is only possible with software like Google’s HAR Analyzer

Note: HAR files contain sensitive information, such as cookies, passwords, and other types of personal data. Remove any compromising data before sharing HAR files with anyone.

The anomaly to look for in HAR files is cookies that are too large and the overall excessive use of cookies.

To reduce cookie size and lighten the request header load:

  • Remove unnecessary third-party plugins from the website.
  • Limit request overhead.
  • Use a cookie-free domain.

5. Disable .htaccess

The .htaccess file affects the global configuration of an Apache server without changing the configuration files.

Error 520 can appear when a redirect was not configured properly in the .htaccess file, or the file itself is corrupted. Disabling the .htaccess file will reveal whether the file is problematic.

1. To disable the .htaccess file, start by opening the apache2.conf file in a text editor (we are using nano):

sudo nano /etc/apache2/apache2.conf

The default location for the Apache config file is one of the following:

  • /etc/httpd/httpd.conf
  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/conf/httpd.conf

2. Find the value of the AllowOverride directive and change it to None.

<Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
</Directory>

3. Save the file and close it with.

4. To apply the changes, restart Apache:

sudo systemctl apache2 restart

6. Check Web Server Error Logs

Error logs provide additional information about where, why, and what error occurred. 

The process of locating or generating error logs varies between hosting providers. However, all error logs feature a similar structure and will provide the following information:

  • The date and time of the incident.
  • The IP address of the client (if the client caused the error to happen).
  • An error message.
  • A path to the affected resource or the line of code causing the issue.

7. Check HTTP Error Response with a cURL Command

Client URL (cURL) commands allow users to get information about the HTTP error response code and request headers.

The general syntax is:

sudo curl -svo /dev/null https://yourwebsitehere.com

A successful response will look like the following example:

*   Trying 111.11.1.111...
* Connected to 111.11.1.111 (111.11.1.111) port 100 (#0)
> GET /login HTTP/1.1
> User-Agent: YourBrowser 1.0
> Accept: */*
> Host: examplewebsite.com
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Date: Day, DD, Month Year Hour:Minute:Second Timezone
{ [11111 bytes data]
* Connection #0 to host 111.11.1.111 left intact

However, the command will not be able to retrieve information if the 520 error has occurred, and the result will look similar to the following example:

*   Trying 111.11.1.111...
* Connected to 111.11.1.111 (111.11.1.111) port 100 (#0)
> GET /login HTTP/1.1
> User-Agent: YourBrowser 1.0
> Accept: */*
> Host: examplewebsite.com
>
* Empty reply from server
* Connection #0 to host 111.11.1.111 left intact

8. Contact Cloudflare Support

If none of the previous methods helped locate the source of the issue, contacting Cloudflare support is the next step.

Cloudflare offers two support methods:

  • Support tickets – available to all accounts and accessible via the admin dashboard.
  • Live chat – available to Business and Enterprise accounts only.

In both cases, representatives will request the following information:

  • URL(s) of the affected resource(s)
  • Cloudflare’s Ray ID from the affected resource(s)
  • The result of entering the following URL in a browser http://example.com/cdn-cgi/trace (replace example.com with the right domain)
  • A HAR file from when Cloudflare was enabled on the website
  • A HAR file from when Cloudflare was disabled on the website

Conclusion

Discovering and resolving errors quickly is paramount to reducing downtimes and ensuring positive user experiences.

Use the information in this guide to prevent, troubleshoot, and resolve 520 errors.

Besides error 520, websites using Cloudflare’s CDN can display a variety of other error messages, a common one being 521: Web server is down. Read our guide to find out what error 521 means and how to troubleshoot and fix it.

[ad_2]

Error 520: What It Means and How to Fix It

Have you ever encountered an Error 520 message when trying to access a website? If so, you’re not alone. Error 520 is a generic error message that appears when a website’s server is unable to successfully process a request. In this article, we’ll explain what Error 520 means and how to fix it.

What Does Error 520 Mean?

Error 520 is a “Web server is returning an unknown error” message. It’s a generic error message that appears when the server is unable to process the request. This could be due to a variety of reasons, such as a misconfigured server, a server overload, or a problem with the website’s code.

How to Fix Error 520

The first step in fixing Error 520 is to identify the cause of the problem. Here are some common causes and solutions:

  • Server Misconfiguration: If the server is misconfigured, it may be unable to process the request. To fix this, contact your web hosting provider and ask them to check the server configuration.
  • Server Overload: If the server is overloaded, it may be unable to process the request. To fix this, contact your web hosting provider and ask them to increase the server’s resources.
  • Website Code: If the website’s code is causing the problem, you may need to contact the website’s developer and ask them to fix the issue.

If none of these solutions work, you may need to contact your web hosting provider for further assistance.

Conclusion

Error 520 is a generic error message that appears when a website’s server is unable to successfully process a request. It can be caused by a variety of issues, such as a misconfigured server, a server overload, or a problem with the website’s code. To fix the issue, you may need to contact your web hosting provider for further assistance.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00