{"id":2524,"date":"2026-04-02T18:46:10","date_gmt":"2026-04-02T13:16:10","guid":{"rendered":"https:\/\/mukundasoftware.com\/blog\/?p=2524"},"modified":"2026-04-03T18:04:49","modified_gmt":"2026-04-03T12:34:49","slug":"cloudflare-error-522-connection-timed-out-7-fixes","status":"publish","type":"post","link":"https:\/\/mukundasoftware.com\/blog\/domain-hosting\/errors\/cloudflare-error-522-connection-timed-out-7-fixes.html","title":{"rendered":"Cloudflare Error 522: First Check Status Pages, Then Try These 7 Fixes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>You see \u201cConnection timed out (Error 522).\u201d Your first thought:<\/strong> <em>\u201cMy server must be dead.\u201d<\/em><br><strong>The truth:<\/strong> Your server could be perfectly online \u2013 but Cloudflare couldn\u2019t finish the \u201chandshake\u201d in time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide doesn\u2019t just repeat \u201ccall your host.\u201d You\u2019ll learn <strong>7 real fixes<\/strong>, including advanced ones (DNS loops, fail2ban, TLS handshake failures). And yes \u2013 sometimes the problem <strong>isn\u2019t your server at all<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd0d Step <strong>#0 \u2013 Check Status Pages First<\/strong> <\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">(<em>Do This Before Anything Else<\/em>)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before you touch a single setting, ask two questions:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Is Cloudflare having an issue?<\/strong><br>\u2192 Visit <a href=\"https:\/\/www.cloudflarestatus.com\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><strong>https:\/\/www.cloudflarestatus.com<\/strong><\/a><br>Look for \u201cHTTP\/SSL\u201d or \u201cCloudflare Dashboard\u201d incidents. If there\u2019s a confirmed outage, <strong>wait<\/strong>. Your site is fine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Is my hosting provider doing maintenance?<\/strong><br>\u2192 Check your host\u2019s status page (e.g., <code>status.hostname.com<\/code>), email notifications, or support Twitter.<br>Many 522 errors happen during <strong>scheduled maintenance<\/strong> or <strong>unplanned network upgrades<\/strong>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f If either status page shows a problem, stop here. You don\u2019t need to fix anything.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udde0 What Actually Happens in Error 522?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cloudflare is the middleman between a visitor and your origin server.<br>To deliver your site, Cloudflare must complete a <strong>TCP handshake<\/strong> (SYN \u2192 SYN\u2011ACK \u2192 ACK) \u2013 think of it as knocking and waiting for the door to open.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Time limits:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>19 seconds for the initial knock (SYN)<\/li>\n\n\n\n<li>90 seconds after the door opens<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If your server doesn\u2019t respond within those limits \u2192 <strong>Error 522<\/strong>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f Important: A 522 can also happen <strong>after<\/strong> the TCP handshake, during the <strong>TLS handshake<\/strong> (if you use HTTPS). The secure \u201cpassword exchange\u201d can timeout too \u2013 even if the door opened fine.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd27 Fix #1 \u2013 Server Overload or Downtime (Most Common)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your server might be drowning: CPU pegged, RAM full, or the web server (Apache\/Nginx) crashed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log into your server control panel \u2192 check CPU\/memory.<\/li>\n\n\n\n<li>Run <code>ping yourdomain.com<\/code> \u2013 if no reply, your server is offline.<\/li>\n\n\n\n<li>Upgrade hosting or optimize your site (caching, image compression).<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd25 Fix #2 \u2013 Firewall Blocking Cloudflare IPs (Very Common)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This is the #1 \u201chidden\u201d cause.<br>Your firewall sees a flood of traffic from the same IPs (Cloudflare\u2019s) and thinks it\u2019s an attack \u2013 then blocks them. Even <strong>fail2ban<\/strong> or <strong>ModSecurity<\/strong> can do this automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><br>Whitelist all <a href=\"https:\/\/www.cloudflare.com\/ips\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><strong>official Cloudflare IP ranges<\/strong><\/a> in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Your hosting firewall (cPanel, iptables, CSF)<\/li>\n\n\n\n<li><code>.htaccess<\/code> (if using Apache)<\/li>\n\n\n\n<li>Your security plugin (Wordfence, etc.)<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udca1 Pro tip: Contact your host and ask: <em>\u201cAre you blocking Cloudflare IPs via ModSecurity or fail2ban?\u201d<\/em><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udce1 Fix #3 \u2013 Incorrect DNS Records<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your Cloudflare <strong>DNS A\/AAAA<\/strong> record points to the <strong>wrong<\/strong> origin IP. Happens after a server migration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><br>Go to <strong>Cloudflare Dashboard<\/strong> \u2192 <strong>DNS<\/strong> \u2192 check your <strong>A record<\/strong>.<br>Does it match your real server IP? If not \u2192 update and wait 5 minutes.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd0c Fix #4 \u2013 KeepAlive Disabled (The Multiplier)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Without HTTP KeepAlive, Cloudflare must re\u2011establish a connection for <strong>every single file<\/strong> (images, CSS, JS). If your server is even slightly slow, those dozens of new \u201cknocks\u201d will eventually timeout.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Apache:<\/strong> <code>KeepAlive On<\/code><\/li>\n\n\n\n<li><strong>Nginx:<\/strong> <code>keepalive_timeout 65;<\/code><\/li>\n\n\n\n<li><strong>IIS:<\/strong> Enable HTTP Keep\u2011Alives<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This alone rarely causes a 522, but it makes every other problem 10x worse.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd12 Fix #5 \u2013 SSL\/TLS Misconfiguration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Even if TCP works, the <strong>TLS handshake<\/strong> can fail (expired certificate, wrong Cloudflare SSL mode).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install a valid SSL on your origin server.<\/li>\n\n\n\n<li>In Cloudflare \u2192 SSL\/TLS \u2192 set <strong>Full (Strict)<\/strong>.<\/li>\n\n\n\n<li>Never use \u201cFlexible\u201d unless you really know the risks.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf10 Fix #6 \u2013 Network Path Issues (Packet Loss \/ BGP)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes Cloudflare and your host have a bad route between them \u2013 packet loss, flapping, or an upstream ISP issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><br>Run a <strong>traceroute<\/strong> or <strong>MTR<\/strong> from your server to <code>1.1.1.1<\/code>.<br>If you see high loss \u2192 send the output to your hosting provider. They can reroute or escalate.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf00 Fix #7 \u2013 DNS Loop with Cloudflare Workers (Advanced)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you use a <strong>Cloudflare Worker<\/strong> that fetches your own hostname, you create a loop. Cloudflare will intentionally return a 522 to stop an infinite request storm.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fetch a different hostname, or<\/li>\n\n\n\n<li>Enable the <code>global_fetch_strictly_public<\/code> compatibility flag, or<\/li>\n\n\n\n<li>Restructure your Worker to avoid self\u2011fetching.<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">This is a \u201cpro\u201d fix \u2013 but it\u2019s saved many developers hours of debugging.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddea Quick Checks for Visitors (It Might Not Be Your Server)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you tear your hair out, try these:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Clear cache + hard refresh<\/strong> (<code>Ctrl+F5<\/code> \/ <code>Cmd+Shift+R<\/code>)<\/li>\n\n\n\n<li><strong>Switch networks<\/strong> (WiFi \u2192 mobile hotspot). If it works, the issue is your local network or ISP.<\/li>\n\n\n\n<li><strong>Use a global uptime tool<\/strong> (Uptrends, DownDetector) \u2013 is the error everywhere or just you?<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcde When to Contact Your Hosting Provider<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019ve tried fixes #1\u20137 and the error remains, contact support with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>traceroute\/MTR<\/strong> from your server to Cloudflare<\/li>\n\n\n\n<li>A <strong>HAR file<\/strong> of the failing request<\/li>\n\n\n\n<li>Timestamps of when the error happens<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That data gets you a real fix, not a generic \u201creboot your server\u201d reply.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd17 Related Resources from Mukunda Software<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Timeouts don\u2019t only happen on websites. If you\u2019re dealing with connection issues elsewhere \u2013 or want to build a more resilient hosting foundation \u2013 these guides help:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/mukundasoftware.com\/blog\/domain-hosting\/what-is-cloud-hosting-its-uses-and-benefits.html\" target=\"_blank\" rel=\"noreferrer noopener\">What is Cloud Hosting? Its Uses and Benefits<\/a><\/strong> \u2013 Understand why cloud infrastructure reduces timeout risks.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/mukundasoftware.com\/blog\/domain-hosting\/what-is-cloud-computing-its-uses-and-benefits.html\" target=\"_blank\" rel=\"noreferrer noopener\">What is Cloud Computing? Its Uses and Benefits<\/a><\/strong> \u2013 Broader context for scalable, always\u2011available apps.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/mukundasoftware.com\/blog\/domain-hosting\/ssl\/website-security-vs-ssl-difference.html\" target=\"_blank\" rel=\"noreferrer noopener\">Website Security vs. SSL: What\u2019s the Difference?<\/a><\/strong> \u2013 SSL misconfigurations are a top 522 cause.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/mukundasoftware.com\/blog\/help\/outlook\/fix-msoutlook-error-0x8004210a-pop-server-timeout.html\" target=\"_blank\" rel=\"noreferrer noopener\">Fix: MSOutlook Error 0x8004210a POP Server Timeout<\/a><\/strong> \u2013 Timeout errors aren\u2019t just for web servers. The <em>logic<\/em> of troubleshooting is the same.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>You see \u201cConnection timed out (Error 522).\u201d Your first thought: \u201cMy server must be dead.\u201dThe truth: Your server could be perfectly online \u2013 but Cloudflare couldn\u2019t finish the \u201chandshake\u201d in time. This guide doesn\u2019t just repeat \u201ccall your host.\u201d You\u2019ll learn 7 real fixes, including advanced ones (DNS loops, fail2ban, TLS handshake failures). And yes &#8230; <a title=\"Cloudflare Error 522: First Check Status Pages, Then Try These 7 Fixes\" class=\"read-more\" href=\"https:\/\/mukundasoftware.com\/blog\/domain-hosting\/errors\/cloudflare-error-522-connection-timed-out-7-fixes.html\" aria-label=\"Read more about Cloudflare Error 522: First Check Status Pages, Then Try These 7 Fixes\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":2525,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[232],"tags":[],"class_list":["post-2524","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-errors"],"_links":{"self":[{"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/posts\/2524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/comments?post=2524"}],"version-history":[{"count":1,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/posts\/2524\/revisions"}],"predecessor-version":[{"id":2526,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/posts\/2524\/revisions\/2526"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/media\/2525"}],"wp:attachment":[{"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/media?parent=2524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/categories?post=2524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mukundasoftware.com\/blog\/wp-json\/wp\/v2\/tags?post=2524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}