[Fixed] – Cloudflare’s “Error 520: Web Server Is Returning an Unknown Error”

cloudflare error 520

Cloudflare’s Error 520 occurs when your web server returns an unknown error to Cloudflare’s proxy. It’s a server-side error, meaning the issue lies with your web hosting server, not Cloudflare itself.

Causes of Error 520 can vary, from server misconfigurations to resource depletion. It’s essential to identify the specific cause to implement the correct fix.

Diagnosing the Issue

Error 520 on cloudflare

Before jumping into solutions, let’s diagnose the problem. Here, we’ll explore the steps to determine the exact cause of Cloudflare’s Error 520 on your website.

  1. Web Server Downtime: The most common reason for Error 520 is your web server being offline or experiencing downtime.
  2. Server Overload: If your server is overwhelmed with traffic, it may not promptly respond to Cloudflare’s requests.
  3. Firewall or Security Plugins: Overly strict security settings, firewalls, or security plugins can sometimes block Cloudflare’s requests.
  4. DNS Misconfiguration: Incorrect DNS settings can confuse Cloudflare and lead to this error.

A server issue likely causes Error 520 on your website. You can effectively troubleshoot and identify the problem by examining your error logs, providing valuable insights for resolution.

Debugging Mode

Enable WordPress debugging mode to get more detailed error messages. Open your site’s “wp-config.php” file and find the line that says define( 'WP_DEBUG', false );. Change false to true, save the file, and reload your site. This may reveal specific errors or warnings that can help you pinpoint the issue.

FIRST THINGS FIRST: Take a backup of your website before initiating any modifications. Try WP Staging!

enable debug mode in WP-Config File to troubleshoot another update

Once you’ve identified the source of the 502 error, it’s time to fix it.

Read more about how to activate the WordPress debug mode.

Solutions for Fixing Cloudflare’s Error 520

Now that we’ve identified the potential causes let’s proceed with a comprehensive step-by-step guide on how to resolve Cloudflare’s Error 520 and restore your website’s functionality:

1. Check Your Server’s Health

The first step is to check the health of your web server. Ensure that it’s not overloaded and is running smoothly. Investigate if your server has been experiencing downtime, and if so, address the underlying issues promptly.

2. Solving HTTP 520 Errors with a Server Restart

To resolve HTTP 520 errors swiftly, consider a quick fix—restart your web server. It can effectively address temporary glitches and restore smooth website operation. Check this option based on your hosting environment for a potential solution.

Web Server Restart

3. Review Cloudflare Settings

Review your Cloudflare settings to ensure they are configured correctly. Pay attention to the DNS settings and ensure your website’s domain is correctly associated with Cloudflare. If you check the “DNS” settings and it is configured correctly, but it always shows you Cloudflare’s “Error 520: Web Server Is Returning an Unknown Error”, try the alternative method written below.

  • Temporarily Deactivate Cloudflare’s shield by heading to your Cloudflare dashboard, tapping into the DNS section, choosing the domain of your choice, and switching off the Proxy status button.
Deactivate Cloudflare's shield

4. Firewall Configuration

Examine your firewall configuration. Ensure that Cloudflare’s IP addresses are whitelisted and not blocked by overly strict security settings. Adjust your firewall rules if necessary.

5. Deactivating .htaccess for Error 502 Resolution

The .htaccess file, crucial for Apache-based websites, can sometimes be the culprit behind a 502 error. To investigate and potentially resolve this issue, consider the following steps:

To disable the .htaccess file and troubleshoot problems, follow this method. First, access your website’s root directory and locate the .htaccess file. Rename it to “.htaccess_disabled”. This action effectively disables its affection on the server. After renaming, check if the 502 error is resolved. If the issue persists, you can revert by renaming the file to “.htaccess”.

disable .htaccess file

This method provides a reversible way to temporarily disable the .htaccess file, allowing you to diagnose and resolve problems without losing your configurations.

6. Contact Cloudflare Support

If all else fails, don’t hesitate to contact Cloudflare’s support team. They can provide valuable insights and assistance in resolving the error.


Fixing Cloudflare’s “Error 520: Web Server Is Returning an Unknown Error” may seem challenging, but you can conquer this issue with the proper steps and patience. Ensure regular server monitoring and proper security settings. Don’t hesitate to seek expert advice when necessary. These strategies will provide your website visitors with a seamless, error-free browsing experience.