How to Fix Error 521 With WordPress and Cloudflare

Error 521

Isn’t your WordPress website hosted in Cloudflare running on your web browser? Is it showing Error 521 on the browser’s window screen despite displaying a web page? Don’t worry! If it happens, it means your website is experiencing a server-side issue. Howsoever, it is a common yet annoying error that usually affects websites using Cloudflare. Everyone who tries to visit your website will see the error 521 message which badly impacts your search engine rankings. Therefore, for you, it should be a prior job to annihilate such type of error as soon as possible.

In this blog post, we’ve got the easy and proactive solving methods covered for you to try and fix your site-related problem in a pinch. Thus, let’s feast your eyes here!

Feasible Reasons That Can Trigger Error 521 With WordPress and Cloudflare

Before jumping to the solving procedure, it is essential to identify what actually causes Error 521 With WordPress and Cloudflare. So, check out the list of possible causes below:

  •        When the web server denies Cloudflare requests for establishing a connection.
  •        When the site-side server is running low or poor.
  •       The Error 521 message generally arises due to an invalid SSL certificate.
  •       When your site’s server is offline.
  •       Enabled Firewall or Security Software can also be one reason for a website’s inaccessibility issue.
  •      If the site that hosted Cloudflare is unable to connect to its origin server.

What causes the Error 521?

Cloudflare cannot establish a connection with your website’s server, which results in error 521. There are three reasons why this can happen:

The server for your website is offline. You should have a relatively close uptime record if you’re using a quality WordPress web host (around 99.9 percent ). This suggests that server unavailability isn’t the most common cause of error 521.
Cloudflare requests are expressly blocked by your server. Some firewalls block IPs that they consider suspect, and Cloudflare queries may fall into this trap.
Your Cloudflare certificate isn’t working properly. Cloudflare’s own Secure Sockets Layer (SSL) certificate can encrypt traffic between your site and its servers. If that certificate has a flaw, the origin server may refuse the connection.
Cloudflare is a reverse proxy service. Instead of all your visitors’ IP addresses heading directly to your originating web server, they will appear to be coming from Cloudflare IPs.

This disproportionate bandwidth and IP addresses will be flagged as an attack by so many (badly constructed) server security solutions.

Effective Solving Tips to Fix Error 521 With WordPress and Cloudflare

It is possible that your web browser and Cloudflare are connected properly but, Cloudflare is unable to connect to the origin server. Later, it results in the Cloudflare error 521 error.

Here are the solutions you can implement to Fix Error 521 from the root in a second. Let’s begin!

Solution 1: Check For Bad Gateway Error

When the origin server is down, your visitors will not be able to access your WordPress website. That’s why; it’s become very essential to check for server errors with an HTTP header checker. All you need to do is to check the server status either with telnet via a remote desktop client or even using the cURL command on your terminal window.

Beneath, we’ll show you how you can use the cURL option:

  •      There is an online cURL tool that makes your work simple and effortless.
  •      Simply, open the HTTP Header Checker tool on your windows and enter the site’s domain name into the search field.
  •      Now, click the “Check” button.

If everything is working fine on the origin server, a 200 success response will be displayed on your Window screen.

Solution 2: Whitelist All Cloudflare’s IP Addresses

If still confronting Error 521 even after confirming your site’s server is online, then whitelist all your Cloudflare IP ranges. To do this, you must modify the .htaccess file only after backing up or downloading your file. Here’s how:

  •      First, log in to the cPanel of your WordPress hosting.
  •      After that, navigate to “File Manager” ≫ public_html
  •      Then, give a click right on the “.htaccess” file and select the “Edit” button.
  •      Paste the following code snippet on the file:
<RequireAny>

Require all granted

Require ip 127.0.0.1

</RequireAny>

  •      Replace 127.0.0.1 with the IP address you want to whitelist for your Cloudflare.
  •     To whitelist numerous IP addresses, gradually enter a new line, add the ‘Require ip 127.0.0.1’ command, and then replace it with the correct IP.
  •      Now, in the end, save the file with new server IPs.

Solution 3: Set Your Website SSL To Flexible SSL

If your WordPress website is using Cloudflare’s server to get access, then you can have various options to use for an SSL certificate. While in most cases, Error 521 occurs with WordPress and Cloudflare if you use the Full SSL certificate. That’s why you are recommended to make changes and set your SSL to flexible SSL. Here’s the required step to perform for the same:

  •      First, log in to your Cloudflare account
  •      Then, click on the “SSL/TCS” tab on your website domain settings.
  •      Now, update to Flexible SSL.
  •      After that, wait for it to get activated.
  •      And then, try to load your website to check it working smoothly without any interpretation.

WordPress Online Support For Error 521 With WordPress and Cloudflare

In this post, we’ve covered the basics info of Error 521, a few common causes, and an intuitive guide on how to fix this issue. Hoping that you are much satisfied with the aforementioned descriptive guidance for resolving error 521 with WordPress and Cloudflare.

If you still fail to remove the error 521 and frequently access your site, you can contact our technical team for WordPress Online Support. They will help you troubleshoot your problem in a minimal time.

Leave a Reply

Your email address will not be published. Required fields are marked *