Fix error Error 521: Web server is down

Error 521 or Error 521: Web server is down occurs because the original web server refused to connect from Cloudflare. More specifically, Cloudflare tried to connect to your original server on port 80 or 443 but received a connection error that was rejected.

Error 521 or Error 521: Web server is down occurs because the original web server refuses to connect from Cloudflare (Cloudflare is a reverse proxy service provider, is an intermediate proxy server between a server and clients) . More specifically, Cloudflare tried to connect to your original server on port 80 or 443 but received a connection error that was rejected.

Fix error Error 521: Web server is down

  1. Common causes of error 521
    1. Web server is offline
    2. Request from Cloudflare is blocked
  2. Troubleshoot Error 521: Web server is down
    1. Experiment with cURL
    2. Experiment with Telnet

Common causes of error 521

Picture 1 of Fix error Error 521: Web server is down

The two most common causes of error 521 are:

Web server is offline

The original web server process (eg Apache or Nginx) may not run or has failed. In that case:

  1. Make sure your web server is running normally.
  2. Review the server error log to find the cause of the error.

If you are unable to perform these tasks, contact the host provider.

Request from Cloudflare is blocked

The original web server or hosting provider network may be blocking requests from Cloudflare.

As a reverse proxy, Cloudflare connects to your server from a Cloudflare IP and all subsequent traffic to the exclusive from a smaller group of Cloudflare IPs. As a result, certain server-side security solutions can distort the increase in legitimate connections from this smaller IP group, and treat this as an attack. This results in some IP Cloudflare being blocked or restricted by speed.

To resolve this issue, whitelist all Cloudflare IP strips in the server firewall or any other original security software. List of IP ranges of Cloudflare:

IPv4

  1. 103.21.244.0/22
  2. 103.22.200.0/22
  3. 103.31.4.0/22
  4. 104.16.0.0/12
  5. 108.162.192.0/18
  6. 131.0.72.0/22
  7. 141,101,64.0/18
  8. 162.158.0.0/15
  9. 172.64.0.0/13
  10. 173.245.48.0/20
  11. 188,114.96.0/20
  12. 190.93.240.0/20
  13. 197.234.240.0/22
  14. 198.41.128.0/17

IPv6

  1. 2400: cb00 :: / 32
  2. 2405: b500 :: / 32
  3. 2606: 4700 :: / 32
  4. 2803: f800 :: / 32
  5. 2c0f: f248 :: / 32
  6. 2a06: 98c0 :: / 29

If you cannot whitelist the Cloudflare IP, contact your hosting provider.

Troubleshoot Error 521: Web server is down

Picture 2 of Fix error Error 521: Web server is down

You can use third-party tools such as cURL or Telnet to check the server's response.

For the following example commands, you need to replace the IP address 1.2.3.4 with the original server's IP address. Alternatively, you can run these tests on port 443.

Experiment with cURL

cURL allows you to simulate an HTTP request, so it is a good tool to check if your original server is working properly. You can run cURL through the Terminal command line tool on Mac OS or Linux.

Run the cURL command for your server IP with A or CNAME record for the domain displayed in the DNS application of the Cloudflare dashboard page.

 curl http://1.2.3.4 -v 

If successful, you will see an HTTP 200 response along with the site's HTML. The unsuccessful cURL request will look like this:

 # curl 1.2.3.4 
 curl: (7) Failed to connect to 1.2.3.4 port 80: Connection refused 

Experiment with Telnet

Windows users can check the connection using Telnet (via Command Prompt).

Run a command similar to the following:

 telnet 1.2.3.4 80 

Error, such as:

 Unable to connect to remote host: Connection refused 

means your web server is not running or blocking requests.

The connection error rejected will look like this:

 # telnet 1.2.3.4 80 Trying 1.2.3.4. telnet: connect to address 1.2.3.4: Connection refused telnet: Unable to connect to remote host 

See more:

  1. Quick fix "This site can't be reached" error on Chrome browser
  2. Quick fix error 107 net :: ERR_SSL_PROTOCOL_ERROR: SSL protocol error on Chrome browser
  3. Steps to fix "Your Preferences can not be read" in Chrome browser
Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile