Tips to Fix Error 521 with WordPress
June 8. 2022
Error 521 occurs in case your web server is refusing Cloudfare connection and if this happens to your WordPress website, it’s important to know how to fix it. But don’t worry – it’s nothing too complicated or difficult. Plus, you have us with WP Full Care to help you! Given that we’ve dealt with error 521 quite a few times, we decided to share our experience and write a detailed guide to help you in case you’re ever in that situation.
What is error 521 and what causes it?
When you try to visit your WordPress website and get a 521 error, it implies your browser is properly connecting to Cloudflare, but Cloudflare isn’t connecting to the server that hosts your website. Before you reach out to WordPress pros and ask for a fix, here are the four most likely causes of the issue:
- The server is currently unavailable.
- Because it considers Cloudflare to be a security danger, the server is blocking or slowing requests from it.
- On port 443, the server is denying Cloudflare’s request.
- A valid SSL certificate is not being presented by the server.
How to easily fix error 521 with WordPress?
As said, when the origin web server refuses Cloudflare connections, Error 521 occurs. If you come across it, don’t panic because we have five troubleshooting procedures that will help you quickly resolve this issue. If you’re not sure what’s generating your 521 issues, start with step 1 and work your way through the steps.
#1 Reach out to your hosting provider
When you receive a 521 error, there are measures you may do to resolve the issue. Some of them, on the other hand, can be time-consuming and complicated. With that in mind, contacting your WordPress hosting provider is the simplest way to fix error 521. A professional web host should be able to explain why this problem is occurring and they could even be able to help you solve the problem.
If you’re not sure how to contact help, go to the website of your hosting provider. Simply search for any Contact Us or Support pages. We recommend using live assistance options wherever possible because this issue is something you want to be resolved asap. Live chat and business phone support, for example, are virtually always faster than ticketing portals or email. If you are unable to get immediate assistance from your hosting provider, you can attempt the procedures below.
#2 Check if your server is offline
It’s always worth verifying whether your server is online when you get a 521 error. If it’s still up and running, you can move on to the next phase of the troubleshooting process. You’ll need to know your server’s IP address to perform this.
You can ping the physical server that hosts your WordPress website using this IP address. If it responds, you’ll have a surefire sign that your server is online. On the other hand, if it doesn’t answer, your server is down and that’s the reason you’re getting a 521 error.
If you’re having trouble locating this IP address, check your hosting provider’s website or online documentation. Many web hosts provide comprehensive lessons on how to locate your IP address. Once you have your server’s IP, you can go to the HTTP Header Checker tool, ping your website’s server and see if it responds Simply paste your IP address into the ‘URL’ field to do this test.
You’ll notice a message like ‘Failed to connect’ or ‘Host Not Found’ if your server is down. In this scenario, you’ll need to contact your hosting company to resolve the issue. On the other hand, your 521 problem isn’t caused by a server outage or downtime if your server is up and running. In that situation, you can follow the steps in this guide to correct the problem.
#3 Whitelist all IP addresses from Cloudfare
Your server may be up and running, but Cloudflare’s IP addresses might be blocked. If that’s the case, when you try to access your WordPress website, you may receive a 521 error. The solution is to whitelist all of Cloudflare’s IP addresses. When you whitelist an IP address, you’re notifying your server that all requests from that address will be accepted.
Whitelisted IPs can be added to your website’s.htaccess file. This is a crucial configuration file that instructs the server on how to behave. To access this file, you’ll need an FTP client such as FileZilla.
By default, most FTP clients hide sensitive files so make sure you enable the “show hidden files” option. Whitelisting IP addresses is a dull task as you’ll have to create a new line for each IP address. Once you’re done, you can visit your website and check if the error is still showing.
#4 Get in touch with your hosting provider to open port 443
Cloudflare offers a variety of encryption options. Before encountering the 521 error, did you go to Full or Full (Strict) mode? We ask this because this could have been the source of the issue.
Cloudflare requires access to port 443, whether in Full or Full (Strict) mode. Some hosts, however, block Cloudflare from accessing this port, resulting in the ‘Message 521’ error. Therefore, enabling port 443 on your server could be a solution. Simply reach out to your hosting provider and ask them to enable this for you.
#5 Upload a Cloudfare Origin Certificate
When utilizing Cloudflare’s Full or Full (Strict) mode, you may still get the 521 error even if port 443 is enabled. Because some servers may only accept connections on port 443 if you have a valid Cloudflare Origin Certificate, this is the case. The traffic between Cloudflare and your web server is encrypted with this certificate.
So if you don’t have an Origin certificate it could be the cause of the error 521 you’re seeing. The good news is that Cloudflare can take you to step by step through the process of generating this certificate. Log into your Cloudflare account to get started. Then select SSL/TLS » Origin Server from the drop-down menu. From there, you’ll be able to follow the instructions and create the Origin Certificate.
Final thoughts on ways to fix error 521 with WordPress
We hope this article helped you understand what caused error 521 and how to fix it with WordPress. As you could see, it’s not difficult at all. But if you want to avoid the hassle, why not get maintenance tailored to your WordPress website? You can rest assured knowing your WordPress website is in great hands!