Cloudflare often returns an error 521 whenever your website turns down a connection with Cloudflare. Usually, this error results from the disturbance by Firewall or any other security software. You will find the error message stating, 'Error 521 Web server is down.' However, don't panic on noticing this error message on your screen. In this article, you'll understand what is error 521 and the ways through which you can fix it.
What Is Error 521?
Cloudflare error 521 arises when Cloudflare is unable to make a TCP connection to your initial server. It tried to link to your origin server on port 443 or 80. However, it got a connection refused error. The error is mainly caused by firewall software. It occurs if the origin server has denied the proxy request of Cloudflare.
Different Ways to Fix the Error 521
After knowing what is error 521 and the main reasons for it, you can proceed to its fixes. Implement the following solutions.
Inspect your origin server
Cloudflare won't connect with your origin server in case it's not configured properly. It will also not link to it if it's offline. So, you should first check your origin server. Ensure that the webserver is operating correctly independent of Cloudflare. You can connect with your hosting provider and enquire whether their servers are online.
Whitelist every Cloudflare IP range in the Firewall of your server
If your site server is online, but you encounter Cloudflare error 521, you should whitelist every IP range of Cloudflare. You can go to this link and check the Cloudflare IP list. Then, you can use this list to:
Make sure that you aren't blocking the IPs of Cloudflare in .htaccess, iptables, or in your Firewall.
It's possible that your hosting provider is rate-limiting. So, check if it's true. You can also check whether they aren't obstructing IP requests from the IP of Cloudflare. If your hosting service is doing it, tell them to whitelist every IP address from www.cloudflare.com/ips.
An incorrect firewall also leads to error 521. It results from the wrong configuration of the Firewall. Due to this, it drops packets rather than refusing a connection. So, deactivate security-related plugins.
Consider specific causes
To fix this problem, you can also perform more specific technical processes. Do the following as per your server settings.
If you've just begun employing Cloudflare's HTTPS, the origin server wouldn't be set to enable the IP addresses of Cloudflare access port 443. Use flexible SSL rather than full SSL at Cloudflare.
Ensure that you are employing the latest versions of mod_security.
Disable and unload the Apache modules like mod_antiloris or mod_reqtimeeout.
Final Words
Hopefully, you understood cloudflare error 521 and why it happens. Use these effective fixes to get rid of it. You can also connect with professional WordPress support services to get a resolution.
Comments