Error 521 is an error that is specifically related to Cloudflare that will pop up when the WordPress site’s server will refuse to connect to Cloudflare.
Cloudflare is a CDN that allows you to increase the security and performance of the website so there is a possibility that you might be using it.
You should know that Error 521 is not specifically for Cloudflare and it could also be for the web server.
It means that when the request was directed to Cloudflare and when Cloudflare sent a request to the server- it was incapable of connecting. You will see the error when the server fails to respond.
If your WP website is blocking Cloudflare’s request, then you will come across this error and it could be either Cloudflare’s or the server’s fault.
Know how to fix Cloudflare error 521
There are some methods that you can use to fix Error 521
Check the webserver
If the issue is from the webserver’s end, then you should if it is working or not. If it is not working, then it is obvious that you will see this error. If you have a number of websites that are hosted on your server then you can see whether the other websites are working or not.
You can also check the status page of the hosting provider. You will get to see all the data in one place. Therefore, if one of the servers fails to work, then you will get to know about it from there.
You will get to know if the webserver is down or it is due to a faulty CDN. You will also get an option to test the webserver in some web hosts from where you can test the webserver.
In the same way, most of the managed hosting or VPS/Dedicated server will offer you an option to check the website. Check the same thing with the terminal, but you should know that this is for advanced users.
Switch HTTP to HTTPS
Cloudflare enables the SSL certificate and when you don’t have the certificate, the entire HTTP requests get redirected. Even if you enter HTTPS://xyz.com, it will be redirected to http://xyz.com because of the protocol.
When the SSL is enabled, Cloudflare redirects the websites to HTTPS.
When you enable the SSL, Cloudflare redirects the websites to HTTPS. However, if the definite domain in your WordPress has been set to HTTP then it will be an infinite loop. Cloudflare will try to redirect the URL to HTTPS while the website will try to send the URL to HTTP which will display Cloudflare error 521.
You can fix it by changing the HTTP to HTTPS by going to the WordPress settings. When you navigate to the general settings, you will come across an option to change the URL. You can do it and reload the page. You can also try to reload the website to check if it is working or not.
If it is still not working, then you need to ensure that you don’t have the redirection plugin which is the reason behind this issue. You can deactivate the plugin and then check if Error 521 has been resolved or not.
Switch Full SSL to Flexible SSL
When it comes to the SSL certificate, there are a number of options that you can choose from. The first option is the full SSL and the other one is the flexible SSL.
- If you are using full SSL then you can change it to the flexible SSL with the help of the following steps:
- Sign in to the dashboard and then click on ‘Crypto’
- Look at the sidebar where you will see an option to select the SSL
- Change it from full to flexible
- Wait till it gets activated and then reload the website
If you have come across some errors in the past then you might have seen that the .htaccess file is involved a couple of times.
You must be aware of the fact that we can’t regenerate the file in order to fix Error 521. You can resolve the error by following the steps mentioned below:
- Open the file manager from the cPanel
- You will come across the .htaccess file but if you don’t see it then you can go to the settings and click on ‘Show hidden files’
- Open the file and then click on ‘Code’ edit tab and edit the file
Ensure that no IP address is blocked. Confirm the IP address from Cloudflare.com/ips and no IP address from the list should be blocked.
We hope that with the help of the above-mentioned steps, you will be able to get rid of Error 521. You can reach out to WordPress Support if there is anything else that you require help with.