Fix Error 521 with WordPress and Cloudflare
Error 521 (also known as error 520) is a Cloudflare-specific error message that shows when your WordPress site’s server refuses to connect to Cloudflare.
This article will teach you how to Fix Error 521 with WordPress and Cloudflare
The Error 521 message is a Cloudflare-specific error message, as you learned above.
It basically implies that your web browser was able to connect to Cloudflare successfully, but Cloudflare was unable to connect to the origin web server, which is your WordPress site’s server.
Cloudflare attempted to connect to the server of your WordPress site but returned a connection rejected message.
Because Cloudflare is unable to connect to your site, it is unable to display it to visitors and instead displays the following message: Error 521
An Error 521 message in action
What Is the Cause of Error 521?
The Error 521 notice is usually triggered by one of two things:
Your WordPress site’s server, for starters, could be down. Even if everything else is set up correctly, Cloudflare will be unable to connect if your WordPress site’s server is down.
Second, your web server may be up and operating, but Cloudflare’s requests are being blocked for whatever reason. Some server-side security solutions may accidentally restrict Cloudflare’s IP addresses due to the way Cloudflare works.
Because Cloudflare is a reverse proxy, all traffic to your origin server will appear to originate from a small number of Cloudflare IPs (rather than each visitor’s unique IP address). As a result, some security systems will consider excessive traffic from a small number of IP addresses to be an attack and will block them.
Cloudflare will be unable to connect as a result, and will instead display the Error 521 message.
How to Fix Error 521 for Cloudflare and WordPress?
Let’s look at how to fix Error 521 in WordPress now that you know what’s going on.
Step 1: Verify that the Origin Server is up and running.
Before you proceed any further, double-check that your WordPress site’s server is up and running. If it isn’t, there’s no need in going through the rest of the troubleshooting steps.
You can use the cURL command to verify this. You can run this from Terminal if you’re on a Mac or Linux.
While cURL is not installed by default on Windows, you can utilize KeyCDN’s online HTTP Header Check tool to check your HTTP headers.
All you have to do is type in http://1.2.3.4, where 1.2.3.4 is your server’s IP address.
Do you want to discover how we grew our traffic by over 1000%?
Join the 20,000+ people who receive our weekly email with WordPress insider secrets!
Now is the time to subscribe.
The Header Check tool from KeyCDN
If you host with GreggHosting, your server IP address may be found in the Sites tab:
What is the IP address of your GreggHosting server?
You may also get it from the A record for your domain in the Cloudflare web dashboard’s DNS section.
You should get an HTTP 200 response if your server is up and running. Alternatively, if you host with GreggHosting , you’ll receive 404 Not Found, which indicates that the web server is operational (there’s just no website connected with that IP address):
A good example of an effective link
You’ll see something like Host Not Found or Failed to connect: if there’s an issue.
Here’s an example of a server issue.
If you’re having trouble with your server and aren’t sure what’s wrong, contact your host’s support (you can access GreggHosting support from anywhere in your dashboard via the Intercom widget).
Step 2: In your server’s firewall, whitelist all Cloudflare IP ranges.
If your WordPress site’s server is up and running but you still get Error 521 while trying to access it, the next step is to whitelist all of Cloudflare’s IP ranges to ensure that your server isn’t blocking them.
A complete list of Cloudflare’s IP ranges may be found here.
Make sure these IP addresses aren’t being blocked in.htaccess, iptables, or your firewall. You should also double-check that your Hosting provider isn’t restricting or banning IP requests from Cloudflare’s IP addresses.
If you’re not sure how to do this, contact your host’s customer service. These IP ranges should already be whitelisted at GreggHosting
Step 3: Think about topics that are more specific to you.
Finally, depending on your server’s configuration, below are some more precise technical actions you can take.
1) If you’re new to Cloudflare’s HTTPS, it’s possible that your origin server isn’t set up to allow Cloudflare’s IP addresses to access port 443. If you can’t get your firewall to allow it, consider Cloudflare’s Flexible SSL instead of Full SSL.
2) If appropriate, make sure you’re using the most recent versions of Bad Behavior and mod security.
3) Disable and uninstall the Apache modules mod antiloris and mod reqtimeout if you’re using them.
Conclusion
If you host with GreggHosting and are still getting the 521 Error after making these changes, please contact our support team using the Intercom chat widget in your GreggHosting dashboard.
How to Set Up Cloudflare APO for WordPress and How to Fix the “SSL Handshake Failed” Error are two recommended readings (5 Methods).
Save time, and money, and improve site performance by using:
Expert WordPress hosting assistance is available 24 hours a day, 7 days a week.
Integration with Cloudflare Enterprise.
With 29 data centers across the world, we can reach a global audience.
With our built-in Application Performance Monitoring, you can improve your performance.
All of this and more is included in a single plan that includes no long-term obligations, aided migrations, and a 30-day money-back guarantee. Check out our plans or speak with a sales representative to find the ideal plan for you.