Community Tip - Fixing Error 521: Web server is down

Error
Try the suggestions in this Community Tip to help you fix Error 521: Web server is down.

Background
A 521 error happens when we are unable to make a TCP connection to your origin server. Specifically, Cloudflare tried to connect to your origin server on port 80 or 443, but received a connection refused error. This is often caused by security or firewall software and happens if the origin server has directly refused Cloudflare’s proxy request.

Quick Fix Ideas

  1. Check your origin web server. The origin web server might not be running; in that case you should: a) Ensure your web server is running normally and b) Review the server’s error logs to see what is causing the error. If you’re unable to perform these tasks, contact your hosting provider.

  2. If you have just moved to Cloudflare and you are seeing a 521 over HTTPS, it is possible that your origin server has not been configured to allow port 443 be accessed by Cloudflare IPs. In this case you should configure your server/firewall to being listening on port 443 and allow us to be able to conect. If this is not possible, you can move to using ‘Flexible’ SSL under the Crypto tab on the dashboard.

  3. Make sure that you’re not blocking CloudFlare IPs in .htaccess, iptables , or your firewall.

  4. Make sure your hosting provider isn’t rate limiting or blocking IP requests from the CloudFlare IPs and ask them to whitelist the IP addresses https://www.cloudflare.com/ips.

  5. Make sure that you’re operating off of the most recent versions of Bad Behavior or mod_security. mod_security’s core rules aren’t blocking CloudFlare requests.

  6. If you are running custom Apache modules, such as mod_antiloris and mod_reqtimeout, disable and unload the modules. These modules will block any time an IP that connects more than 22 times. Since all connections are now coming from a CloudFlare IP, you will definitely hit the limit causing the error page. As soon as you unload the module, the issue will disappear.

  7. If your firewall is configured to DROP packets rather than refuse connections, it will cause a 521; meaning an incorrectly configured firewall can actually masquerade as a connection timeout 522 error.

  8. If you’re 521 errors when using Workers to load Javascript on a site, note that Workers subrequest can override the DNS origin address by making subrequest to external site. Check the script to confirm you’re testing the correct origin server.

Lite Reading

Background Resources
Knowledge Base
YouTube

Research The Issue
Community
Google

If You Need More Help
This community of other Cloudflare users may be able to assist you, if not, login to Cloudflare and then contact Cloudflare Support. When you contact support, make sure to include as much of this information as possible: time stamped log files from your origin server, RayID, domain name, error messages, screen shots, and/or HAR file(s).

Expert Comments Appreciated
This Community Tip will remain open for input from Community experts and those familiar with this issue. We really appreciate comments that start with words like: “The three things I always try”, or “Do this first” or “In my experience”.

This is a Cloudflare Community Tip, to review other tips click here.

Çevirmek…traduzir…翻译…traducir…Traduire…Übersetzen…:globe_with_meridians: Translate

2 Likes
Server is up, but i see 502 and 521 error on chrome and firefox
Getting 521 just from https request
Any solution to 521 error?
Plz fix my 521 error
521 Error sometime
521 error, can anyone help me?
Why am I having Error 521 Web server is down
Please help with Error 521
Cloudflare load balancer 521 error but my server is ok
Changed DNS and now get 521 error with cloudflare on, but not with it turned off
Error 521 Ray ID: 47ed58c1db7f989b • 2018-11-24 16:45:34 UTC
There was an error on our website Error 521 link to the website http://kinoworld.club/. Help me deal with the problem
Error 521 Web Server Down
Error 521 but works when CF is disabled
Please am having Error 521 on my website,
Hostgator + CloudFlare SSL Error
Error 521 Ray ID: 47ed58c1db7f989b • 2018-11-24 16:45:34 UTC
CloudFlare cannot connect to webserver on port 80
Error 521 Server Down
Unusual 521's with firewall whitelists
Web Server is Down
[fixed] Error 521 when server is running
GETTING 521 ERROR: domain not pointing to the origin server
Error 521 on Google Cloud Platform VM Instance
Error 521,Ray ID: 4e45e5f03ea513a5 • 2019-06-09 20:36:31 UTC Web server is down
My site keeps going down Error 521
521 Webserver down
My site shows 521 error but sitemeer.com says it is up
521 - web server down
521 error CloudFlare with my websites
Cloudflare states webserver is down although reachable through ip
Community Tip - All Published Tips
Error 521 web server down only when editing Wordpress posts (Cloudflare + WP Bakery + WPML)
Error 521 GoDaddy and Cloudflare
521error please help me to solve
Getting Error 521 - Web host says problem lies with Cloudflare
521 from cloudflare, but pausing makes site work again
SSL not working on subdomain
Server Down and web down
Testing SSL by pausing Cloudflare - Godaddy hosted website
Alguno usa namecheap? error 521
We are Free Web Hosting provider and we active cloudflare but when user place order get cloudflare error
Не могу зайти на сайт

This topic was automatically closed after 14 days. New replies are no longer allowed.