How to Fix Error 520: Web Server Is Returning an Unknown Error - Website Vidya (2024)

Table of Contents[Hide][Show]
  • What Is Error 520?
  • What Causes Error 520?
  • How to Fix Error 520?+
    • 1. Temporarily Disable Cloudflare:
    • 2. Verify DNS Records
    • 3. Restart PHP and Web Server
    • 4. Disable .htaccess
    • 5. Check Headers and Cookies
    • 6. Check Web Server Error Logs
    • 7. Check HTTP Error Response with a cURL Command
    • 8. Contact Cloudflare Support
  • Other Error Fixes
  • Conclusion

How to Fix Error 520? It’s a frustrating and complex error code. It indicates that the web page is not reachable. There could be several reasons behind this error code 520. This article covers, what this error code means, why it occurs and how to troubleshoot it.

What Is Error 520?

How to Fix Error 520: Web Server Is Returning an Unknown Error - Website Vidya (1)

Error 520 is an HTTP status code that is typically displayed when a web server returns an empty or incomplete response to the client, or when the server takes too long to respond. This error is often associated with Cloudflare, a content delivery network (CDN) and DDoS protection service.

In the context of Cloudflare, a 520 error indicates that the server (where the website is hosted) is unable to send a valid response to Cloudflare within a certain timeframe. This could be due to various reasons, such as server overload, network issues, or misconfigurations.

What Causes Error 520?

Error 520 can occur due to various reasons, with the following being the most prevalent:

PHP Applications Crashing: When PHP applications on the server crash, it can trigger an Error 520.

Incorrectly Configured DNS Records: Misconfigurations in DNS records may lead to the generation of the 520 error.

Corrupt or Incorrectly Configured .htaccess File: Issues with the .htaccess file, such as corruption or incorrect configurations, can contribute to the occurrence of Error 520.

Large Request Headers and Excessive Cookie Usage: If the size of request headers is substantial, or there’s an excessive use of cookies, it may result in the server returning a 520 error.

Missing Request Headers: In cases where necessary request headers are missing, the server might fail to respond appropriately, leading to the error.

Empty Response from Server: When the server fails to provide a valid response or returns an empty response, it can trigger the 520 error.

How to Fix Error 520?

1. Temporarily Disable Cloudflare:

If the root cause of the issue is within Cloudflare, temporarily disabling it can restore accessibility to the affected page.

To disable Cloudflare temporarily:

  • Log in to your Cloudflare account.
  • Head to the Overview tab in the left-hand panel.
  • Scroll down to the Advanced Actions section and choose “Pause Cloudflare on Site.”

By temporarily pausing Cloudflare, you can isolate whether the problem is related to the CDN service, and this step may assist in troubleshooting and resolving the underlying issue.

2. Verify DNS Records

Domain Name System (DNS) records, residing in authoritative DNS servers, play a crucial role in defining:

  • The association of an IP address with a domain.
  • Protocols for managing incoming requests to that domain.
  • It’s imperative for Cloudflare’s seamless functionality that its DNS records align with those in the domain’s DNS management system.

To check Cloudflare’s DNS records for a website:

  • Log in to your Cloudflare account.
  • Choose the specific website encountering the error 520.
  • Navigate to the DNS section by selecting DNS > Records in the left-hand menu.
  • Ensuring the synchronization of DNS records is essential for proper communication between Cloudflare and the domain, minimizing the likelihood of encountering error 520.

3. Restart PHP and Web Server

Error 520 may also manifest when a PHP application crashes. Resolving this issue often involves restarting the web server hosting the website.

For various software stacks, PHP can be restarted through different methods. Below are instructions for restarting Apache or Nginx servers on various operating systems.

Apache Web Server

Restart the Apache server on Ubuntu or Debian systems, by running:

sudo systemctl restart apache2

On CentOS 7, restart the Apache server with:

sudo apachectl -k restart

Nginx Web Server

Gracefully restart an Nginx server by running:

sudo systemctl reload nginx

Forcefully restart Nginx with:

sudo systemctl restart nginx

Alternatively, force close and restart Nginx and related processes using:

sudo /etc/init.d/nginx restart

For users on hosting platforms with a graphical user interface (GUI), PHP may be restarted through platform-specific tools. Refer to the hosting platform’s user manual or contact customer support for guidance in such cases.

Restarting the PHP and web server components can often resolve issues associated with PHP application crashes, mitigating the occurrence of Error 520.

4. Disable .htaccess

The .htaccess file wields influence over the global configuration of an Apache server, providing a means to adjust settings without altering core configuration files.

Error 520 may keep on appearing if the file itself is corrupted or if a redirect is improperly configured in the .htaccess file. Disabling the .htaccess file can help us diagnose the issue.

To disable the .htaccess file, follow the steps below:

Open the apache2.conf file in your favourite text editor:

sudo vim /etc/apache2/apache2.conf

The Apache config file may be located at one of the following default paths:

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

Locate the value of the AllowOverride directive and modify it to “None.”

 Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted

Save and close the file.

Apply the changes by restarting Apache:

sudo systemctl restart apache2

Disabling the .htaccess file through these steps aids in troubleshooting, helping identify whether issues stem from this configuration file. Remember to reevaluate and adjust configurations once the root cause is determined and resolved.

5. Check Headers and Cookies

Error 520 can arise if the size of Cloudflare’s request headers surpasses the allowable limit of 32 KB, with an individual header limit of 16 KB. To troubleshoot and address this issue, inspecting the size of request headers in the origin server’s HAR (HTTP Archive) file is crucial.

Here’s how 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.”

3. Navigate to the Network tab.

4. Enable the “Preserve log” option.

5. Click the Clear (stop sign) button.

6. Reload the page.

7. Right-click below the navigation bars of the inspect tool.

8. Choose “Save all as HAR with content.”

This process is nearly identical across major web browsers based on Chromium (except Firefox).

HAR files can be analyzed using tools like Google’s HAR Analyzer. Keep in mind that HAR files contain sensitive data, such as cookies and passwords. Remove compromising information before sharing HAR files.

Examine HAR files for anomalies, particularly large cookies and overall excessive cookie usage. To address this:

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

By scrutinizing and optimizing headers and cookies, you can potentially alleviate the occurrence of Error 520 and enhance the performance of your web application.

6. Check Web Server Error Logs

Error logs play a crucial role in gaining deeper insights into the occurrence, origins, and nature of errors. They offer valuable information about the specifics of an error, aiding in effective troubleshooting.

While the procedure for accessing or generating error logs may differ among hosting providers, the fundamental structure remains consistent. Error logs typically include the following essential details:

  1. Date and Time of Incident: Timestamps provide precise information about when an error occurred.
  2. Client IP Address: If the error is client-induced, the logs often reveal the IP address associated with the triggering event.
  3. Error Message: A concise description of the error, offering insights into its nature and possible causes.
  4. Path to Affected Resource or Line of Code: Crucial details pointing to the location of the error, aiding in pinpointing the root cause.

To harness the power of error logs:

Consult your hosting provider’s documentation for guidelines on accessing error logs.

Look for sections titled “Error Logs” or similar in your hosting control panel.

By regularly checking and interpreting web server error logs, you empower yourself to swiftly identify, understand, and address issues, ensuring the smooth operation of your website or application.

7. Check HTTP Error Response with a cURL Command

Using cURL commands provides a straightforward method to inspect HTTP error responses and request headers. The syntax is as follows:

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

For a successful response, the output resembles the following:

* 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: your_webssite.com>* Empty reply from server* Connection #0 to host 111.11.1.111 left intact

By leveraging cURL commands, you gain valuable insights into the communication between your client and the server, aiding in the diagnosis of HTTP errors such as the elusive 520 error.

8. Contact Cloudflare Support

If all the troubleshooting methods fail to pinpoint the issue, reaching out to Cloudflare support becomes the logical next step.

Cloudflare provides two avenues for support:

  1. Support Tickets: Accessible to all accounts, this method can be initiated through the admin dashboard.
  2. Live Chat: Exclusive to Business and Enterprise accounts, live chat offers real-time assistance.

When contacting Cloudflare support, be prepared to provide the following essential information:

URL(s) of the Affected Resource(s): Indicate the pages or resources experiencing the issue.

Cloudflare’s Ray ID: Obtainable from the affected resource(s), the Ray ID is crucial for support analysis.

Result of Accessing http://your_website.com/cdn-cgi/trace: Replace your_website.com with the correct domain and share the result obtained from this URL in a browser.

HAR File with Cloudflare Enabled: Provide an HTTP Archive (HAR) file captured when Cloudflare was active on the website.

HAR File with Cloudflare Disabled: Similarly, furnish a HAR file captured when Cloudflare was deactivated on the website.

By supplying this comprehensive information, Cloudflare support can expedite the troubleshooting process and offer targeted assistance in resolving the persistent Error 520 issue.

Other Error Fixes

  • How to Fix the HTTP 415 Error on Your Website
  • How to fix “the uploaded file exceeds the upload_max_filesize directive in php.ini.” error
  • How to Fix a 408 Request Timeout Error
  • How to Fix 403 Forbidden Error in NGINX Ubuntu
  • Error Establishing a Database Connection in WordPress Fix
  • Fix 502 Bad Gateway Nginx Error in Ubuntu – 4 Simple Steps
  • Fix 504 Gateway Timeout Nginx Error – 5 Simple Steps
  • PHP5-FPM 502 Bad Gateway Error (connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory)

Conclusion

In conclusion, resolving Cloudflare’s Error 520: Web Server Is Returning an Unknown Error demands a systematic and thorough approach. The provided troubleshooting steps guide users through identifying potential culprits, ranging from server misconfigurations to issues within Cloudflare settings. By examining aspects like DNS records, server logs, request headers, and the .htaccess file, users can isolate and rectify the root cause.

Additionally, tools like cURL commands and HAR file analysis offer insights into the communication between clients and servers, aiding in pinpointing elusive errors. If all else fails, reaching out to Cloudflare support with detailed information ensures personalized assistance.

Ultimately, successfully resolving Error 520 involves a combination of technical understanding, meticulous investigation, and collaboration with support services. Employing these strategies empowers users to not only fix the immediate issue but also enhance the overall stability and performance of their web applications under the protection of Cloudflare.

Share this post:

Share on LinkedInShare on X (Twitter)Share on PinterestShare on FacebookShare on Email

How to Fix Error 520: Web Server Is Returning an Unknown Error - Website Vidya (2024)

FAQs

How to Fix Error 520: Web Server Is Returning an Unknown Error - Website Vidya? ›

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.

How to fix web server is returning an unknown error error code 520? ›

How to Fix Error Code 520
  1. Restart PHP/Apache/Nginx.
  2. Whitelist Cloudflare IPs.
  3. Adjust TCP idle timeouts.
  4. Reduce header size.
  5. Empty response header.
Feb 7, 2024

What is error code 520 on Uworld? ›

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 is a 520 network error? ›

A 520 error occurs when the connection started on the origin web server, but that the request was not completed. The most common reason why this would occur is that either a program, cron job, or resource is taking up more resources than it should causing the server not to be able to respond to all requests properly.

What is error 520 on safari? ›

Accessing a URL using Safari or make.com results in a 520 error from Cloudflare, accessing the same URL from Chrome or cURL produces the correct result. The reason for the 520 is that the request crashes the apache server on the origin server with a Segmentation Fault.

What does web server is returning an unknown error mean? ›

When your site's visitors see error 520 in their browser, it means Cloudflare is sending the message because your server returned an empty, unknown, or unexpected response. The 520 error can be approached through troubleshooting first to find the cause and then fixed following these steps.

How do I fix a website error code? ›

When your website is not loading, here are the 10 most common troubleshooting steps to solve it:
  1. Check if the website is down. ...
  2. Check the internet connection. ...
  3. Use a different device. ...
  4. Analyze the error message. ...
  5. Switch to another web browser. ...
  6. Verify the DNS records. ...
  7. Check the error logs. ...
  8. Use developer tools.

Is UWorld not working now? ›

No, we are not detecting any problems with UWorld right now.

The last outage detected for UWorld was on Tuesday, July 30, 2024 with a duration of about 2 hours.

What is error code 520 on VPN? ›

What is Error 520? Error 520 is a response from Cloudflare indicating that a web server cannot fulfill a request. It occurs when the server receives an invalid or incorrectly interpreted request, resulting in an empty response.

What is reset in UWorld? ›

First, reset your UWorld subscription. This will erase all the statistics you accumulated during the first two years of medical school and allow you to more accurately track your progress during your dedicated Step 1 study period.

What does 520 mean in code? ›

Well, 520 is hom*ophonic to “I love you” in Chinese! In fact, the 20th of May (520) is pronounced (wǔ èr líng)which sound very similar to 我爱你(wǒ ài nǐ)I love you, that is why the 20th (and 21st) have been labeled as the Internet Valentine's Day(网络情人节).

How do I reset my network error? ›

Network reset removes any network adapters you have installed and the settings for them. After your PC restarts, any network adapters are reinstalled, and the settings for them are set to the defaults. Select Start > Settings > Network & internet > Advanced network settings > Network reset.

How can I fix a network error? ›

Often you can:
  1. Unplug the router from the electrical outlet and make sure the lights on the router go out.
  2. Wait 30 seconds.
  3. Plug the router back in and wait 30 seconds for all the lights to come back on.

How do I get rid of Error 520? ›

It is a temporary server-side error caused by a connection issue between the web server and the origin server. Refreshing the page, clearing your browser cache and cookies, or contacting your hosting provider or website administrator can often resolve the issue.

How do I fix Safari server error? ›

How Can You Fix 'The Safari Can't Find Server' Message? [7 Easy Solutions]
  1. Ensure The Site Is Live / Works On Other Browsers. ...
  2. Check Your Internet Connection. ...
  3. Disable The 'Cross Website Tracking' Feature. ...
  4. Clear Cache And Cookies. ...
  5. Update Your MacOS. ...
  6. Check Time & Date Settings. ...
  7. Change DNS Settings.
May 30, 2024

How can I fix my Safari browser? ›

Safari troubleshooting on Mac
  1. Make sure cables are connected, and that your network devices (such as a router) are turned on.
  2. Check your internet connection.
  3. Try working in another app that uses the internet, such as Mail, to see if your Mac is connected to the internet.

What is Cloudflare 520 error log? ›

​​ Error 520: web server returns an unknown error

upstream prematurely closed connection while reading response header from upstream is a common error we may notice in our logs. This indicates the origin web server was having issues which caused Cloudflare to generate 520 errors.

How to fix origin DNS error? ›

Make Sure Your IP Address And Domain Will Resolve

For a CNAME record to point to an external domain instead of using an IP address, ensure that the target domain gets a DNS response. You can also use the Cloudflare DNS lookup tool to help confirm that the CNAME can resolve.

What is error code 520 in nginx? ›

Background Error 520 is essentially a catch-all response when something unexpected happens or when the origin server incorrectly interprets or does not tolerate a request due to a protocol violation or an empty response.

What is error code 520 on HP laptop? ›

Sure Start RTID (520)

An HP Sure Start Runtime Intrusion detection event was detected. The most common cause of this error is a security issue, such as a hacking attempt. This could indicate a defective memory module.

References

Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6460

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.