If your site uses Cloudflare CDN, sometimes you may encounter a headache problem: an "Error 521 Web Server Is Down" pop-up when you visit a page. But this doesn't necessarily mean that the server is really down, it's likely that the server just isn't responding correctly to Cloudflare's requests.
![Image [1] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/05/20250530152918371-image.png)
Step 1: Check server firewall settings
The most common cause of Error 521 One of the reasons for this is that the server firewall is blocking Cloudflare's IP address. First make sure that the server allows Cloudflare requests.
Cloudflare will use certain IP addresses to connect to your site, these IP addresses are officially provided and you can go to the official documentation (Google "Cloudflare IP ranges" to find them) to see the full list.
![Image [2] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609143721906-image.png)
Common Practice:
- Log in to the server with SSH and run the following command to check the firewall status (e.g. with UFW):
sudo ufw status
- If you find that Cloudflare's IP is blocked, you can release it with the following command:
sudo ufw allow from to any port 80,443
- To save time, it is recommended to add all IP addresses provided by Cloudflare directly to thefirewallswhitelisting to avoid similar problems in the future.
![Image [3] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609143945739-image.png)
Step 2: Check if the web service is running properly
Ensure that the web service(e.g. Apache or Nginx) is running properly and listening on the correct port.
Check the way:
- Apache:
sudo systemctl status apache2
- Nginx:
sudo systemctl status nginx
Make sure that the service state is active (running) and not stopped or reporting errors. If it is stopped, try restarting it:sudo systemctl restart apache2
maybe sudo systemctl restart nginx
Step 3: Manually Test Server Port Connectivity
You can simulate Cloudflare access directly with the command line tool curl or telnet to see how the server responds.
Test command (replace below with your server IP):
curl -I http://
curl -I https://
or use telnet to check the port:
telnet 80
telnet 443
If it connects normally, you will see a message back from the server indicating that the port is open and responding to requests normally.
Step 4: Bypass Cloudflare Authentication Server Response (Modify Local Hosts)
Another more intuitive way to test is to modify the hosts file of your local computer and directly access the server IP to see if the website can be opened normally:
- The hosts file for Windows systems is at:
C:\Windows\System32\drivers\etc\hosts
- The hosts file for a Mac or Linux system is at:
/etc/hosts
Add it at the end of the hosts file:Your server IP Your domain name
Example:123.123.123.123 example.com
Then save and flush the DNS cache:
- Executed under Windows (Administrator CMD):
ipconfig /flushdns
- Performed under Mac:
dscacheutil -flushcache
Once you've made the changes, use your browser to access your domain name (at this point it will directly access your server IP, bypassing Cloudflare) and see if the page displays properly:
- If you can access it normally, the server side is fine and the problem is between Cloudflare and the server.
- If you cannot access it, you need to check the server itself (ports, web service status, etc.).
Step 5: Check if the SSL certificate is OK (if using HTTPS)
If your site has enabled HTTPSThe problem may also occur with Error 521, which usually means that the server's SSL ConfigurationThere are questions.
You can run it server-side:
openssl s_client -connect Your server IP:443
Check to see if the server is correctly providing the SSL CertificateIf the SSL handshake fails, you may need to regenerate or repair the certificate. If the SSL handshake fails, you may need to regenerate or repair the certificate.
![Image [4] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609145041100-image.png)
Step 6: Check Server Load
Sometimes, the server's CPU or memory usage is too high, which can also cause Cloudflare connections to time out and Error 521 to appear.
![Image [5] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609145356814-image.png)
Use the command to view the server load:
top
If you find that the CPU or memory usage is close to 100%, it is possible that the server is underperforming or there is a process that is taking up too many resources, at which point you need to optimize the configuration or upgrade the server.
Final step: check that Cloudflare is configured correctly
In the DNS area of the Cloudflare panel, confirm:
- Are the DNS records set up correctly and in the "orange cloud" state (Proxied).
![Image [6] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609145933177-image.png)
- Verify that the server IP address is correct and has not been entered incorrectly.
In the "SSL/TLS" settings, make sure:
- SSL mode is set correctly (usually Flexible or Full)
![Image [7] - Troubleshooting Cloudflare Error 521 Server Response Test Methodology](https://www.361sale.com/wp-content/uploads/2025/06/20250609151335748-image.png)
- Origin certificates and server-side certificates are configured consistently.
If all of the above are checked and the server itself responds normally, and Cloudflare is configured correctly, you've basically ruled out a server-side problem.
summarize
To troubleshoot Error 521, the point is to confirm that the server is rejecting the Cloudflare Check that the firewall is not blocking Cloudflare. Check to see if Cloudflare is blocked by your firewall, and make sure that your web service is running properly, that your ports are open, and that your SSL configuration is working correctly. If the server is responding normally, the problem probably lies in the Cloudflare settings. Troubleshooting item by item, basically can find the reason.
Link to this article:https://www.361sale.com/en/58491The article is copyrighted and must be reproduced with attribution.






















![Emoji[wozuimei]-Photonflux.com | Professional WordPress repair service, worldwide, rapid response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![Emoticon[baoquan] - Photon Wave Network | Professional WordPress Repair Services, Worldwide Coverage, Rapid Response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments