{"id":77974,"date":"2026-10-27T17:25:25","date_gmt":"2026-10-27T15:25:25","guid":{"rendered":"https:\/\/tremhost.com\/blog\/?p=77974"},"modified":"2026-11-05T18:52:44","modified_gmt":"2026-11-05T16:52:44","slug":"cloudflare-error-522-how-to-fix-connection-timed-out","status":"publish","type":"post","link":"https:\/\/tremhost.com\/blog\/cloudflare-error-522-how-to-fix-connection-timed-out\/","title":{"rendered":"Cloudflare Error 522: How to Fix Connection Timed Out"},"content":{"rendered":"<p>Cloudflare error 522 &#8220;Connection timed out&#8221; means Cloudflare could not complete a connection to the server that hosts your website (the origin) in time. Cloudflare itself is usually working; the problem is almost always on the origin side: a firewall blocking Cloudflare, an overloaded or offline server, or a DNS record pointing at the wrong IP address. Fixing it means checking those three things in order.<\/p>\n<h2>What does Cloudflare error 522 mean?<\/h2>\n<p>When a site is proxied through Cloudflare, every visitor connects to Cloudflare first, and Cloudflare then connects to your origin server to fetch anything it does not already have cached. According to Cloudflare&#8217;s own documentation, error 522 is returned in two situations:<\/p>\n<ul>\n<li><strong>Before the connection is established:<\/strong> the origin does not reply to Cloudflare&#8217;s connection request (a TCP SYN) with a SYN+ACK within 19 seconds.<\/li>\n<li><strong>After the connection is established:<\/strong> the origin does not acknowledge Cloudflare&#8217;s request for a page within 90 seconds.<\/li>\n<\/ul>\n<p>Error 522 does not mean your site has been hacked or your files have gone. It means the path between Cloudflare and your server is not working at that moment.<\/p>\n<h2>How is 522 different from other Cloudflare 5xx errors?<\/h2>\n<table>\n<thead>\n<tr>\n<th>Error<\/th>\n<th>What it means<\/th>\n<th>Where to look first<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>521 Web server is down<\/td>\n<td>The origin actively refused Cloudflare&#8217;s connection<\/td>\n<td>Web server stopped, or a firewall rejecting Cloudflare<\/td>\n<\/tr>\n<tr>\n<td>522 Connection timed out<\/td>\n<td>The origin did not answer in time<\/td>\n<td>Firewall silently dropping traffic, server overload, wrong origin IP<\/td>\n<\/tr>\n<tr>\n<td>523 Origin is unreachable<\/td>\n<td>Cloudflare could not find a route to the origin<\/td>\n<td>DNS record, origin IP or network routing<\/td>\n<\/tr>\n<tr>\n<td>524 A timeout occurred<\/td>\n<td>The connection worked, but the page took too long to generate<\/td>\n<td>Slow scripts, long database queries, heavy plugins<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>What causes Cloudflare error 522?<\/h2>\n<h3>A firewall is blocking or rate-limiting Cloudflare<\/h3>\n<p>Cloudflare&#8217;s documentation names this as the most common cause. Because all traffic arrives from Cloudflare&#8217;s IP ranges, a server firewall, a security plugin or an .htaccess rule can treat Cloudflare as one very busy visitor and block or throttle it. Visitors then see 522 even though the server is running.<\/p>\n<h3>The origin server is overloaded or offline<\/h3>\n<p>If CPU, memory or the number of PHP processes is exhausted, the server may stop accepting new connections. Causes include a traffic spike, bot traffic, a heavy WordPress plugin, slow database queries or a backup running at a busy time. A server that is down for maintenance or has crashed produces the same symptom.<\/p>\n<h3>The DNS record points to the wrong IP address<\/h3>\n<p>This is common straight after a hosting move. The A record in Cloudflare still points to the old server, or to an IP address that no longer answers. Check both the root domain and www.<\/p>\n<h3>Keepalives are disabled or packets are being dropped<\/h3>\n<p>Cloudflare recommends enabling HTTP keepalive on the origin web server, so connections can be reused. Network problems between your host and Cloudflare that drop packets can also cause intermittent 522 errors.<\/p>\n<h3>A migration was not finished<\/h3>\n<p>If you moved hosts recently, the new server may not yet be configured to serve the domain, or its firewall may not yet allow Cloudflare.<\/p>\n<h2>How to fix Cloudflare error 522 step by step<\/h2>\n<ol>\n<li><strong>Confirm the scope.<\/strong> Check whether the whole site or only some pages return 522, and whether other sites on the same server work. One page failing points to that page&#8217;s code; everything failing points to the server or network.<\/li>\n<li><strong>Check that the origin is up.<\/strong> Sign in to cPanel or your server and look at CPU and memory usage, the web server status and the error logs. If you manage a VPS, confirm that the web server service is running.<\/li>\n<li><strong>Verify the origin IP in Cloudflare.<\/strong> In the Cloudflare dashboard, open DNS and compare the A record for the root domain and www with the IP address in your hosting welcome email. Correct it if it differs, and leave MX and other email records alone. Tremhost&#8217;s Help Centre explains <a href=\"https:\/\/tremhost.com\/help\/edit-dns-records\">how to edit DNS records<\/a>.<\/li>\n<li><strong>Allow all Cloudflare IP ranges.<\/strong> Make sure your server firewall, security software and any .htaccess rules allow every range listed at cloudflare.com\/ips, and that rate limiting does not apply to them. Do not switch the firewall off completely; find and correct the rule that is blocking Cloudflare.<\/li>\n<li><strong>Test the origin directly.<\/strong> Temporarily set the DNS record to &#8220;DNS only&#8221; (grey cloud) or test from a computer with the origin IP in its hosts file. If the site loads directly but not through Cloudflare, the issue is between Cloudflare and the server, usually the firewall. If it fails directly too, the issue is on the server. Turn the proxy back on afterwards, because &#8220;DNS only&#8221; exposes your server&#8217;s IP address.<\/li>\n<li><strong>Reduce load.<\/strong> If the server is overloaded, find the cause in the logs: a bot, a plugin, a cron job or a real traffic spike. Block abusive bots, enable caching and upgrade resources only once you know the cause.<\/li>\n<li><strong>Enable keepalives<\/strong> on the web server if they are turned off.<\/li>\n<li><strong>Escalate with evidence.<\/strong> If nothing above fixes it, send your host the exact times of the errors, the Cloudflare Ray ID shown on the error page and the steps you have tried. Cloudflare also asks for a traceroute or MTR from the origin to a Cloudflare IP if you open a case with them.<\/li>\n<\/ol>\n<h2>Does a paid Cloudflare plan prevent error 522?<\/h2>\n<p>No. Cloudflare Pro and Business add security and performance features, and caching can serve some pages without contacting the origin each time, but any request that needs the origin still fails if the origin cannot be reached. A reliable host, correct firewall rules and accurate DNS are what prevent 522 errors. What a managed plan can change is who notices and fixes the problem.<\/p>\n<h2>How to prevent future 522 errors<\/h2>\n<ul>\n<li>Keep Cloudflare&#8217;s IP ranges on your firewall allow list, and review it after any security software change.<\/li>\n<li>Update DNS in Cloudflare immediately after any hosting move, and keep the old server running until the switch is confirmed.<\/li>\n<li>Monitor CPU, memory and process limits, and fix heavy plugins or queries before traffic grows.<\/li>\n<li>Use Cloudflare caching for static files and, where appropriate, for whole pages, so fewer requests reach the origin.<\/li>\n<li>Block abusive bots at Cloudflare rather than on the origin, so the server does less work.<\/li>\n<li>Know who manages your server and how to reach them during an outage.<\/li>\n<\/ul>\n<h2>Can Tremhost help with Cloudflare and hosting problems?<\/h2>\n<p>Tremhost is a Cloudflare partner and offers Cloudflare plans configured and monitored by its team, billed in US dollars and payable by EcoCash, ZimSwitch or card. Armor Guard provides Cloudflare Pro for one site at $9 a month or $90 a year, compared with $25 a month for Cloudflare Pro bought directly. You can also try Cloudflare Pro or Business free for 15 days without a card through the <a href=\"https:\/\/tremhost.com\/cloudflare-pro-trial\">Cloudflare trial<\/a>. The full range, including Armor Shield on Cloudflare Business, is on the <a href=\"https:\/\/tremhost.com\/cloudflare\">Tremhost Cloudflare page<\/a>.<\/p>\n<p>To be clear about the limits: a Cloudflare plan does not fix an overloaded or unreachable server. If 522 errors come from the origin, the server or the site itself needs attention, and support for that is available by ticket or WhatsApp, Monday to Friday, 08:00 to 17:00 CAT.<\/p>\n<h2>Frequently asked questions<\/h2>\n<h3>Is error 522 Cloudflare&#8217;s fault?<\/h3>\n<p>Rarely. Error 522 is generated by Cloudflare, but it reports a problem reaching your origin. Check your server, firewall and DNS before assuming a Cloudflare outage.<\/p>\n<h3>Why does error 522 come and go?<\/h3>\n<p>Intermittent 522 errors usually point to rate limiting, a server that is overloaded only at busy times, or packet loss between the host and Cloudflare.<\/p>\n<h3>Can a WordPress security plugin cause error 522?<\/h3>\n<p>Yes. A plugin that limits requests per IP can block Cloudflare, because many visitors arrive from the same Cloudflare addresses. Configure it to read the real visitor IP from Cloudflare&#8217;s headers, or allow Cloudflare&#8217;s ranges.<\/p>\n<h3>Will turning off Cloudflare fix error 522?<\/h3>\n<p>Switching to &#8220;DNS only&#8221; can bring the site back if the problem is a firewall blocking Cloudflare, but it removes Cloudflare&#8217;s protection and exposes your server&#8217;s IP address. Use it to diagnose, then fix the cause and turn the proxy back on.<\/p>\n<h2>Next step<\/h2>\n<p>If you want Cloudflare Pro configured and watched by a team in Harare, start with <a href=\"https:\/\/tremhost.com\/armorguard\">Armor Guard<\/a> at $9 a month, or begin the free 15-day trial first.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What Cloudflare error 522 means, what causes it and how to fix it step by step, from firewall rules and DNS records to an overloaded server.<\/p>\n","protected":false},"author":226,"featured_media":77393,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[366],"tags":[],"class_list":["post-77974","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cybersecurity"],"_links":{"self":[{"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/posts\/77974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/users\/226"}],"replies":[{"embeddable":true,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/comments?post=77974"}],"version-history":[{"count":2,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/posts\/77974\/revisions"}],"predecessor-version":[{"id":81251,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/posts\/77974\/revisions\/81251"}],"wp:attachment":[{"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/media?parent=77974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/categories?post=77974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tremhost.com\/blog\/wp-json\/wp\/v2\/tags?post=77974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}