Cloudflare Error 521: 4 Methods to Fix It

When a web browser displays the message “Error 521: Web server is down”, it means that the website is experiencing a server-side problem. It is a common mistake that affects websites that use . This error occurs when the origin server rejects Cloudflare’s connection request.

Here we will explain what causes the 521 error, along with methods to fix it.

Additionally, we will also share how to fix similar issues to prevent your website from experiencing other Cloudflare errors.

Before you begin, make sure you have access to the origin web server. Otherwise, you won’t be able to follow the troubleshooting methods in this tutorial.

Error codeError 521Cloudflare Error TypeserverError Variationweb server not workingCauses of the errorServer configuration issues
The server blocks requests from Cloudflare
The web server is offline
Bad encryption settings

What causes error 521: Web server is down?

As a (CDN) service, Cloudflare helps speed up websites by establishing a (TCP) connection with a website’s server upon receiving a request from a web browser.

When the web server denies Cloudflare’s connection requests, the browser will display the 521 error message.

Some of the causes of the origin web server not returning a connection error are:

  • Server configuration issues. Make sure the server is configured correctly when you set up this CDN.
  • The server blocks requests from Cloudflare. This CDN acts as a reverse proxy, meaning all connections to your server will come from Cloudflare IPs. Some server-side security solutions can block large requests from a single IP address.
  • The web server is down. If your hosting provider experiences downtime, the website will not respond to requests from Cloudflare. Also, this error can occur when the origin web server process, such as or NGINX, has stopped working properly.
  • Bad encryption settings. Cloudflare has its own certificate (SSL) and encryption modes. Therefore, the origin server might be blocking requests due to encryption settings.

One of the ways to find out the cause of the 521 error is to check the server error logs. If you have previously enabled PHP error logging, find the log in the file home//.logs/error_log_.

How to fix error 521 in 4 easy steps

Make sure you have access to the Cloudflare web server and control panel before you start troubleshooting the 521 error. Also, remember after you’re done to see the changes.

See also  .ch Domain: Buy and Register Today

Important! We recommend that you check if the website is down for everyone or just for you.

1. Check if the origin server is working

Checking the is another way to find out the cause of the 521 error. If there is ongoing maintenance or the hosting provider is experiencing downtime, your server will be blocking IP requests. In addition to the server status, check the connection of your origin web server.

If you are familiar with the use of Terminaluse the Packet Internet Groper (PING) command for Linux or .

Another method to make sure the origin server is working is to . One of the causes of this Cloudflare-specific error message is websites reaching their usage limit. Memory and of the Central processing unit (CPU).

The server is unable to respond to HTTPS requests from Cloudflare when it is overloaded. To check the limits using , go to -> plan history. The purple lines of the graphics memory usage Y CPUs must not touch the Red linessince it is the maximum threshold.

If you are close to reaching the maximum threshold, upgrade your or switch to another hosting type.

For those facing error 521 with WordPress, we recommend removing unnecessary plugins. Some plugins can generate a large load on the origin server of the web. The WordPress site’s server might be blocking requests from Cloudflare for using too many resources.

Finally, contact your hosting support if you don’t have access to your server’s connectivity.

2. Test the connection to the server

If your server’s firewall software blocks Cloudflare’s IP addresses, then it will display the message “Error 521: Web server is down. Another method to fix the 521 error is to make sure that your hosting provider has not enabled rate limiting of IP requests from Cloudflare IP ranges.

Since this CDN acts as a reverse proxy, all connections to your server come from Cloudflare’s IP address instead of your visitor’s real IP address. Run a (cURL) command to check the connectivity of the URL and the server. The cURL command is installed on macOS, Linux, and Windows 10 or later by default.

See also  How to install PostgreSQL on Ubuntu 18.04

Alternatively, check the connection to the server to make a safe list of Cloudflare IP ranges. This will override server-side security solutions from blocking requests from Cloudflare. Check the at your hosting provider to include the .

For this method, use the file .htaccess inside of the File Manager. Then add the code allow fromand the Cloudflare IP addresses between the lines:

#DO NOT REMOVE THIS LINE

The code will look like the following image:

With , there is a IP Manager to allow access or block specific addresses without having to encrypt. go to -> Others -> IP Manager and include the Cloudflare IPs in the section Allow an IP addressand click Add.

To fix the 521 error with WordPress, use a plugin like to help manage access to Cloudflare IP ranges. This method also checks if the WordPress site’s server is refusing to connect to the CDN due to IP filtering.

Important! For Apache users, make sure to disable and download custom Apache modules like mod_antiloris and mod_reqtimeout. These modules block any IP address that requests a connection more than 22 times.

3. Check your encryption settings

Cloudflare’s encryption modes help connect the CDN to your web origin server. The connection refused error can occur if you are not using the correct encryption mode. For this method, go to your Cloudflare dashboard and select the button SSL/TLS to fix the 521 error.

They can be:

  • Flexible. All connections between Cloudflare and your origin are over HTTP. Use this flexible SSL if you can’t set up an SSL certificate for your domain.
  • Complete. Cloudflare connects to the origin server using HTTP or HTTPS, depending on the visitor’s request. Choose full SSL mode if you have an SSL certificate.
  • Strict. As in Full mode, visitors can decide which protocol to use. However, this mode has more requirements for certificates of origin.

If you are not sure of your encryption mode, turn on the SSL/TLS Recommender in the same configuration.

See also  Security in web applications: What is it, how does it work and the best services

4. Check for problems with the website

If none of the above methods work, disable Cloudflare temporarily to remove the connection refused error message. Check if your website has any other issues before using the CDN again.

Important! Cloudflare will need about 1-2 hours to display the fully disabled version. Purging the Cloudflare cache may make the process faster, but it still won’t be instant.

Troubleshooting other Cloudflare bugs

You may experience other Cloudflare issues, such as 520 and 522 errors. If your website displays the error 520: Web server is returning an unknown error, check if the origin web server has crashed. Also, check the response header or disable your file .htaccess.

With the message, the most common causes are usage overload and Cloudflare IP addresses being blocked by the firewall. The method to fix this error is similar to how to fix Cloudflare error 521. Also, checking Cloudflare’s DNS area can also help.

Contact your hosting provider or Cloudflare support services if these issues persist.

conclusion

If your website displays the message “Error 521: Web server is down”, it means that your origin server is not responding to requests from Cloudflare. The 521 error is usually caused by a server firewall or other security software blocking Cloudflare IPs.

Here are the four methods to fix this issue:

  • Check if your origin server is working fine.
  • Make sure your hosting provider’s network does not block Cloudflare IPs.
  • Choose the appropriate SSL/TLS encryption mode.
  • Temporarily disable Cloudflare.

We have also shared some tips for a WordPress website for easier steps to fix error 521. Feel free to comment below which method works best for you.

Carolina is a digital marketing enthusiast with experience in content creation, SEO, and social media management. In her free time she likes to read, watch movies and bake.

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x