{"id":1390,"date":"2020-06-07T01:56:11","date_gmt":"2020-06-06T17:56:11","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=1390"},"modified":"2026-01-05T17:41:52","modified_gmt":"2026-01-05T09:41:52","slug":"error-521-web-server-is-down","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/error-521-web-server-is-down","title":{"rendered":"Error 521: Web server is down"},"content":{"rendered":"<p>Error 521 occurs because the origin web server refuses a connection from Cloudflare. More specifically,\u00a0Cloudflare tried to connect to your origin server on port 80 or 443 but received a\u00a0<em>connection refused<\/em> error.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/12\/error-521.webp\" alt=\"Error 521\" width=\"1021\" height=\"539\" \/><\/p>\n<hr \/>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h2 class=\"mkb-anchor__title\">Common causes<\/h2>\n<\/div>\n<p>The two most common causes leading to Error 521 are:<\/p>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h4 class=\"mkb-anchor__title\"><strong style=\"font-size: 1.5em;\">The web server is offline<\/strong><\/h4>\n<p>&nbsp;<\/p>\n<\/div>\n<p>The origin web server process (e.g. Apache or Nginx) might not be running or has crashed. In that case:<\/p>\n<ul>\n<li>Ensure your web server is running normally.<\/li>\n<li>Review the server\u2019s error logs to see what is causing the error.<\/li>\n<li style=\"list-style-type: none;\"><\/li>\n<\/ul>\n<p>If you\u2019re unable to perform these tasks, contact your host provider.<\/p>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h3 class=\"mkb-anchor__title\"><strong>\u00a0<\/strong><\/h3>\n<\/div>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h3 class=\"mkb-anchor__title\"><strong>Cloudflare requests are block<\/strong><\/h3>\n<\/div>\n<p>The origin web server or hosting provider\u2019s network might be blocking Cloudflare\u2019s requests.<\/p>\n<p>As a reverse proxy, Cloudflare connects to your server from a Cloudflare IP and all subsequent traffic comes exclusively from a smaller set of Cloudflare IPs. As a result, certain server-side security solutions might mistake the increase in legitimate connections from this smaller set of IPs as an attack. This results in some<\/p>\n<p>Cloudflare IPs being block or rate-limit.<\/p>\n<p>To resolve this issue, whitelist all Cloudflare IP ranges in your server\u2019s firewall or any other security software at the origin. See the list of\u00a0<a href=\"https:\/\/www.cloudflare.com\/ips\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare IP ranges<\/a>.<\/p>\n<p>If you\u2019re unable to whitelist Cloudflare IPs, contact your host provider.<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h2 class=\"mkb-anchor__title\">Troubleshoot Error 521<\/h2>\n<\/div>\n<p>You can use third-party tools like\u00a0<em>cURL<\/em>\u00a0or\u00a0<em>Telnet<\/em>\u00a0to test origin server response.<\/p>\n<p>For the example commands shown below, you need to replace IP address\u00a0<em>1.2.3.4<\/em> with the IP address of your origin server. Also, you can run these tests against port 443.<\/p>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\"><\/div>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h3 class=\"mkb-anchor__title\"><strong>Test with cURL<\/strong><\/h3>\n<\/div>\n<p>cURL allows you to simulate a HTTP request, so it is a good tool for checking that your origin server is working properly. You can run cURL via the\u00a0<strong>Terminal<\/strong>\u00a0command line tool on Mac OS or Linux.<\/p>\n<p>Run a cURL command against your server IP using the\u00a0<em>A<\/em>\u00a0record or\u00a0<em>CNAME<\/em>\u00a0for your domain shown in the\u00a0<strong>DNS<\/strong>app of the Cloudflare dashboard.<\/p>\n<p>curl -v<\/p>\n<p>If successful, you should see an\u00a0<em>HTTP 200<\/em>\u00a0response along with the HTML of your website. A failed cURL request looks similar to this:<\/p>\n<p># curl 1.2.3.4<\/p>\n<p>curl: (7) Failed to connect to 1.2.3.4 port 80: Connection refused<\/p>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h3 class=\"mkb-anchor__title\"><strong>\u00a0<\/strong><\/h3>\n<\/div>\n<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\">\n<h3 class=\"mkb-anchor__title\"><strong>Test with Telnet<\/strong><\/h3>\n<\/div>\n<p>Windows users can test a connection using\u00a0<strong>Telnet<\/strong>\u00a0(via the\u00a0<strong>Command Prompt<\/strong>).<\/p>\n<p>Run a command similar to this:<\/p>\n<p>telnet 1.2.3.4 80<\/p>\n<p>&nbsp;<\/p>\n<p>An error, such as:<\/p>\n<p>Unable to connect to remote host: Connection refused<\/p>\n<p>means that your web server isn\u2019t running or is blocking requests.<\/p>\n<p>&nbsp;<\/p>\n<p>A refused connection error would look similar to this:<\/p>\n<p># telnet 1.2.3.4 80 Trying 1.2.3.4\u2026 telnet: connect to address 1.2.3.4: Connection refused telnet: Unable to connect to remote host<\/p>\n<p>&nbsp;<\/p>\n<p>If you need more step-by-step help or clarification, feel free to check out our <a href=\"https:\/\/www.servergigabit.com\/guide\/\">detailed guide<\/a> for further assistance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error 521 occurs because the origin web server refuses a connection from Cloudflare. More specifically,\u00a0Cloudflare tried to connect to your origin server on port 80 or 443 but received a\u00a0connection refused error. Common causes The two most common causes leading to Error 521 are: The web server is offline &nbsp; The origin web server process (e.g. Apache or Nginx) might&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[43],"kbtag":[1499],"class_list":["post-1390","kb","type-kb","status-publish","hentry","kbtopic-cloudflare","kbtag-error-521"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=1390"}],"version-history":[{"count":2,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1390\/revisions"}],"predecessor-version":[{"id":4956,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1390\/revisions\/4956"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=1390"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=1390"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=1390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}