{"id":40659,"date":"2021-12-03T05:56:07","date_gmt":"2021-12-03T05:56:07","guid":{"rendered":"\/tutorials\/?p=40659"},"modified":"2026-11-20T17:48:54","modified_gmt":"2026-11-20T17:48:54","slug":"how-to-fix-error-522","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-fix-error-522\/","title":{"rendered":"What is Error 522 and how to fix it?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p class=\"wp-block-paragraph\">Error 522 is an <strong>HTTP status code indicating a connection timeout between a CDN service, like Cloudflare, and your website&#8217;s origin server<\/strong>. This error means Cloudflare tried to connect to your server to fetch content for a visitor, but the server took too long to respond.<\/p><p class=\"wp-block-paragraph\">Common causes include an offline or overloaded origin server, a firewall that blocks or rate-limits Cloudflare requests, and a DNS record that points to the wrong server IP address. The connection can also time out if KeepAlive is disabled on the origin server.<\/p><p class=\"wp-block-paragraph\">To fix Error 522, first check whether your web server is online and responding. Then review your Cloudflare DNS records, firewall rules, and KeepAlive settings. After making a change, reload the affected page with Cloudflare active to confirm the error is gone.<\/p><p class=\"wp-block-paragraph\">Here&rsquo;s a quick summary of the error:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Error code<\/strong><\/td><td>Error 522<\/td><\/tr><tr><td><strong>Error type<\/strong><\/td><td>Server error<\/td><\/tr><tr><td><strong>Error variation<\/strong><\/td><td>Connection timed out<\/td><\/tr><tr><td><strong>Error causes<\/strong><\/td><td>Server overload<br>Firewall blocking Cloudflare IPs<br>Incorrect DNS<br>KeepAlive disabled<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<\/p><h2 id=\"h-what-causes-the-cloudflare-error-522\" class=\"wp-block-heading h-t-title-2\">What causes the Cloudflare Error 522?<\/h2><p class=\"wp-block-paragraph\">A Cloudflare Error 522 is an <a data-click-id=\"hgr-post-content-link-http-status-code\" href=\"\/ca\/tutorials\/http-status-codes\/\" data-type=\"link\" data-id=\"\/tutorials\/http-status-codes\">HTTP status code<\/a> commonly associated with origin server issues, such as resource overload, firewall restrictions, DNS misconfigurations, and network connectivity problems.<\/p><ul class=\"wp-block-list\">\n<li><strong>Server overload<\/strong>. The origin server is overwhelmed with too many requests and can&#8217;t respond to new ones, including Cloudflare&#8217;s. This is common on shared hosting plans, especially during sudden traffic spikes.<\/li>\n\n\n\n<li><strong>Server offline<\/strong>. The origin server is down or offline due to a crash, maintenance, or other technical issues. If the server is offline, it can&#8217;t respond to any requests.<\/li>\n\n\n\n<li><strong>Firewall blocking Cloudflare requests<\/strong>. A firewall on your server, a security plugin, or your hosting provider&#8217;s network might be blocking Cloudflare&#8217;s IP addresses. Since Cloudflare acts as a proxy, its IPs must be whitelisted.<\/li>\n\n\n\n<li><strong>Incorrect DNS settings<\/strong>. The <strong>A<\/strong> record (or <strong>AAAA<\/strong> record) in your Cloudflare DNS settings doesn&#8217;t point to the correct IP address of your origin server. This sends Cloudflare&#8217;s requests to the wrong place.<\/li>\n\n\n\n<li><strong>Network issues<\/strong>. Connectivity problems between Cloudflare and your server, or issues with your hosting provider&#8217;s network, can interrupt the connection.<\/li>\n\n\n\n<li><strong>KeepAlive disabled<\/strong>. Cloudflare uses KeepAlive headers to maintain a stable, persistent connection. If this setting is disabled on your origin server, the connection can fail, leading to a 522 error.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">Please note that the problem almost always lies with your origin server, not with Cloudflare or the visitor&#8217;s connection.<\/p><div class=\"wp-block-image\"><figure data-wp-context=\"{&quot;imageId&quot;:&quot;6b0b492781e26&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6b0b492781e26\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"669\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/error-522-web-browser.png\/public\" alt=\"A web browser showing a Cloudflare Error 522 Connection timed out message.\" class=\"wp-image-40642\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 id=\"h-how-to-fix-error-522-connection-timed-out\" class=\"wp-block-heading h-t-title-2\">How to fix Error 522 Connection timed out<\/h2><p class=\"wp-block-paragraph\">To fix a &#8220;Connection timed out&#8221; error 522, first, <strong>check if your web server is online and not overloaded<\/strong>. Then, verify that your Cloudflare DNS settings point to the correct server IP address. Finally, review your server&#8217;s firewall settings to confirm Cloudflare&#8217;s IPs aren&#8217;t blocked and check that KeepAlive is enabled.<\/p><p class=\"wp-block-paragraph\">If you prefer a visual guide, our video tutorial walks you through fixing Error 522:<\/p><figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Cloudflare error 522: How to fix it\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/axYMNCuL_hE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n  <div class=\"youtube-shortcode\">\n    <div class=\"row\">\n      <div class=\"col-7 col-sm-8 d-flex align-items-center\">\n        <img decoding=\"async\" class=\"channel-logo\" src=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/youtube-channels\/hostinger-academy.jpg\" alt=\"youtube channel logo\">\n        <div class=\"d-flex flex-column justify-content-between\">\n          <span class=\"slogan d-none d-sm-block\">Subscribe For more educational videos!<\/span>\n          <span class=\"channel-name\">Hostinger Academy<\/span>\n        <\/div>\n      <\/div>\n      <div class=\"col-5 col-sm-4 d-flex align-items-center justify-content-end\">\n          <a data-click-id=\"hgr-post-content-link-subscribe\" class=\"subscribe-button\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" href=\"http:\/\/www.youtube.com\/channel\/UCbNIC-svDbtUOH2qsLnPQPg?sub_confirmation=1\">\n            <img decoding=\"async\" src=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/icons\/youtube.svg\" alt=\"subscribe\">\n            <span>Subscribe<\/span>\n          <\/a>\n      <\/div>\n    <\/div>\n  <\/div>\n\n    \n\n\n<div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg aria-hidden=\"true\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Before you start, it&#8217;s a good idea to <a data-click-id=\"hgr-post-content-link-check-if-your-website-is-down\" href=\"\/ca\/tutorials\/is-this-website-down\/\">check if your website is down<\/a> for everyone using a tool like Uptrends and confirm that Cloudflare&#8217;s system status is operational.\n            <\/p><\/div>\n\n\n\n<\/p><h3 id=\"h-1-check-if-the-web-server-is-working\" class=\"wp-block-heading h-t-title-3\">1. Check if the web server is working<\/h3><p class=\"wp-block-paragraph\">Check your hosting dashboard for outages and review your server&rsquo;s error logs around the time the 522 appeared. If your host provides a way to test the origin directly, check whether it responds to an HTTP or HTTPS request.<\/p><p class=\"wp-block-paragraph\">Next, check your site&#8217;s resource usage. If your server is hitting its CPU or RAM limits, it won&#8217;t be able to respond to new requests. Hostinger users can find this in their Hostinger dashboard:<\/p><ol class=\"wp-block-list\">\n<li>In the Hostinger dashboard, go to <strong>Websites<\/strong> and select <strong>Manage site<\/strong> for the affected website.<\/li>\n\n\n\n<li>In the sidebar, open <strong>Hosting plan &rarr; Resources Usage<\/strong>.<\/li>\n\n\n\n<li>Check whether CPU, memory, or process usage reached your plan&rsquo;s limits around the time the error appeared.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context=\"{&quot;imageId&quot;:&quot;6b0b492784ad8&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6b0b492784ad8\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1836\" height=\"1380\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=1024,h=1024,fit=scale-down\" alt=\"Hostinger hPanel dashboard showing website hosting resource usage.\" class=\"wp-image-136041\"  sizes=\"auto, (max-width: 1836px) 100vw, 1836px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">If you&#8217;re hitting the limits, it will slow your site and cause this error. To fix this:<\/p><ul class=\"wp-block-list\">\n<li><strong>Optimize your site<\/strong>. Remove unnecessary plugins, as some create a high load on the server.<\/li>\n\n\n\n<li><strong>Revise code<\/strong>. Poorly optimized code can cause high CPU usage.<\/li>\n\n\n\n<li><strong>Upgrade your plan<\/strong>. If you regularly hit your limits, you may need to <a data-click-id=\"hgr-post-content-link-upgrade-your-hosting-plan\" href=\"\/support\/1583459-how-to-upgrade-a-hosting-plan-at-hostinger\/\">upgrade your hosting plan<\/a> to get more resources.<\/li>\n<\/ul><figure class=\"wp-block-image size-full\"><a data-click-id=\"hgr-post-content-link-ca-web-hosting\" class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/ca\/web-hosting\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<h3 id=\"h-2-review-cloudflare-dns-settings\" class=\"wp-block-heading h-t-title-3\">2. Review Cloudflare DNS settings<\/h3><p class=\"wp-block-paragraph\">Check that the Cloudflare DNS record for the hostname showing Error 522 points to the correct origin server. For example, if the error appears on <code>www.example.com<\/code>, start with the record for <code>www<\/code>.<\/p><p class=\"wp-block-paragraph\">First, find your website&rsquo;s IP address in your hosting dashboard. If you use Hostinger, go to <strong>Websites &rarr; Manage site &rarr; Hosting plan &rarr; Plan details<\/strong> and copy the <strong>Website IP address<\/strong>.<\/p><div class=\"wp-block-image\"><figure data-wp-context=\"{&quot;imageId&quot;:&quot;6b0b49278a194&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6b0b49278a194\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2160\" height=\"782\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=1024,h=1024,fit=scale-down\" alt=\"Hostinger hPanel Plan details, with the Website IP address highlighted.\" class=\"wp-image-136042\"  sizes=\"auto, (max-width: 2160px) 100vw, 2160px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">Then compare that information with your Cloudflare DNS settings:<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li>Select your domain in Cloudflare and go to <strong>DNS &rarr; Records<\/strong>.<\/li>\n\n\n\n<li>Find the record for the hostname showing Error 522.<\/li>\n\n\n\n<li>Compare the <strong>Content<\/strong> field with the information from your host. An A record should match your server&rsquo;s IPv4 address, and an AAAA record should match its IPv6 address. If the hostname uses a CNAME record, check that it points to the hostname your provider gave you.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context=\"{&quot;imageId&quot;:&quot;6b0b49278d0db&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6b0b49278d0db\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1051\" height=\"480\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/public\" alt=\"Cloudflare DNS settings page showing A records and their IP addresses.\" class=\"wp-image-40645\"  sizes=\"auto, (max-width: 1051px) 100vw, 1051px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"wp-block-paragraph\">If the record is incorrect, click <strong>Edit<\/strong>, enter the correct value, and click <strong>Save<\/strong>. Then reload the URL that showed the error.<\/p><p class=\"wp-block-paragraph\">DNS changes can take up to <strong>24 hours<\/strong> to propagate, but this often resolves the 522 error. You can also try purging the Cloudflare cache to speed things up. Additionally, we recommend setting your Cloudflare encryption mode to <strong>Full<\/strong> to prevent other issues.<\/p><h3 class=\"wp-block-heading h-t-title-3\">3. Allow Cloudflare IP ranges through the origin firewall<\/h3><p class=\"wp-block-paragraph\">Your server&rsquo;s firewall can block or rate-limit Cloudflare requests. Check the firewall logs around the time the 522 appeared for blocked connections from the <a data-click-id=\"hgr-post-content-link-official-cloudflare-ip-ranges\" href=\"https:\/\/www.cloudflare.com\/ips\/\" target=\"_blank\" rel=\"noopener\">official Cloudflare IP ranges<\/a>.<\/p><p class=\"wp-block-paragraph\">If you manage the firewall, update the rule to allow traffic from those ranges on the HTTP or HTTPS ports your website uses. If your hosting provider manages the firewall, send them the error timestamp and ask them to check whether Cloudflare&rsquo;s requests were blocked or rate-limited. Then reload the affected page with Cloudflare active.<\/p><h3 class=\"wp-block-heading h-t-title-3\">4. Check KeepAlive on your origin server<\/h3><p class=\"wp-block-paragraph\">KeepAlive lets Cloudflare reuse an existing connection to your web server for multiple requests. If it&rsquo;s disabled, Cloudflare has to open a new connection for each request.<\/p><p class=\"wp-block-paragraph\">If you manage an Apache server, check your <a data-click-id=\"hgr-post-content-link-keepalive-settings\" href=\"\/ca\/tutorials\/improving-website-performance-enabling-keep-alive\/\" data-type=\"link\" data-id=\"\/tutorials\/improving-website-performance-enabling-keep-alive\/\">KeepAlive settings<\/a> and confirm that <code>KeepAlive On<\/code> is set in the server or virtual host configuration. If you change the setting, reload Apache and test the page that showed Error 522. If your hosting provider manages the web server, ask them to confirm that KeepAlive is enabled.<\/p><h3 class=\"wp-block-heading h-t-title-3\">5. Pause Cloudflare briefly to test your origin server<\/h3><p class=\"wp-block-paragraph\">If Error 522 persists, you can briefly pause Cloudflare to see whether your origin server responds to direct requests. Use this test only if your origin accepts direct traffic and has an HTTPS certificate browsers trust. While Cloudflare is paused, requests go straight to your server without Cloudflare&rsquo;s firewall protections.<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li>In Cloudflare, select your domain and go to <strong>Overview &rarr; Advanced Actions &rarr; Pause Cloudflare on Site<\/strong>.<\/li>\n\n\n\n<li>Once the pause takes effect, reload the URL that showed Error 522.<\/li>\n\n\n\n<li>Re-enable Cloudflare as soon as you finish testing.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">If the page loads only while Cloudflare is paused, ask your hosting provider to check the connection between Cloudflare and your server. Share the affected URL, the time the error occurred, and the Cloudflare Ray ID from the error page.<\/p><h2 id=\"h-how-do-i-know-if-error-522-has-been-fixed\" class=\"wp-block-heading h-t-title-2\">How do I know if Error 522 has been fixed?<\/h2><p class=\"wp-block-paragraph\">You&#8217;ll know Error 522 has been fixed <strong>when your website loads normally in your browser without the &#8220;Connection timed out&#8221; message<\/strong>.<\/p><p class=\"wp-block-paragraph\">To be certain, you can clear your browser cache and test the site again. You can also use online tools like Uptrends or GTmetrix to test your website&#8217;s accessibility from different locations.<\/p><p class=\"wp-block-paragraph\">If the site loads successfully, and you&#8217;ve confirmed your server isn&#8217;t overloaded and Cloudflare&#8217;s IPs are whitelisted, the error is resolved.<\/p><h2 id=\"h-troubleshooting-other-cloudflare-errors\" class=\"wp-block-heading h-t-title-2\">Troubleshooting other Cloudflare errors<\/h2><p class=\"wp-block-paragraph\">For specific Cloudflare errors like <strong>520<\/strong> (unknown error), <strong>check for server application crashes and incompatible headers<\/strong>; for <strong>521<\/strong> (web server is down), <strong>verify that your origin server is active and not blocking requests<\/strong>; and for <strong>524<\/strong> (connection timed out), <strong>investigate long-running server processes<\/strong>.<\/p><p class=\"wp-block-paragraph\"><strong>Error 520: Web server is returning an unknown error<\/strong><\/p><p class=\"wp-block-paragraph\">A <a data-click-id=\"hgr-post-content-link-520-error\" href=\"\/ca\/tutorials\/error-520\/\">520 error<\/a> often results from a crash in the web server application or from response headers that are incompatible with Cloudflare.<\/p><p class=\"wp-block-paragraph\">To troubleshoot it, first, double-check that your Cloudflare DNS records are correct. If they are, try temporarily disabling your <strong>.htaccess<\/strong> file to see if a rule is causing the problem. You can also inspect your server&#8217;s response headers and cookies to check they are formatted correctly and not too large.<\/p><p class=\"wp-block-paragraph\"><strong>Error 521: Web server is down<\/strong><\/p><p class=\"wp-block-paragraph\">This error means Cloudflare could not connect to your origin server at all. The most common causes are that your server is genuinely offline or that your firewall is actively blocking Cloudflare&#8217;s requests.<\/p><p class=\"wp-block-paragraph\">To fix <a data-click-id=\"hgr-post-content-link-error-521\" href=\"\/ca\/tutorials\/error-521\/\">Error 521<\/a>, verify your origin server is running and responsive. Then, test the connection to the server and, most importantly, check your firewall or security settings to confirm all of Cloudflare&#8217;s IP addresses are whitelisted.<\/p><p class=\"wp-block-paragraph\"><strong>Error 524: A timeout occurred<\/strong><\/p><p class=\"wp-block-paragraph\">A 524 error is similar to a 522, but with a key difference: it means the server did establish a connection with Cloudflare but took too long to send back an HTTP response.<\/p><p class=\"wp-block-paragraph\">This almost always results from a long-running process on your server, like a complex database query or a script that is taking minutes to execute. To resolve this, you must investigate your server&#8217;s resource usage and logs to identify and optimize that slow process.<\/p><h2 id=\"h-keep-your-hosting-environment-running-smoothly\" class=\"wp-block-heading h-t-title-2\">Keep your hosting environment running smoothly<\/h2><p class=\"wp-block-paragraph\">Maintaining a smoothly running hosting environment requires a proactive approach, and fixing Error 522 is a key part of that. By resolving this connection timeout, you&#8217;ve restored the link between your server and Cloudflare, making your site accessible to visitors again.<\/p><p class=\"wp-block-paragraph\">To prevent this and other issues from happening in the first place, it&#8217;s important to regularly check your server&#8217;s resources, keep DNS settings accurate, and confirm your firewall rules are correct.<\/p><p class=\"wp-block-paragraph\">We also recommend you to <a data-click-id=\"hgr-post-content-link-monitor-website-uptime\" href=\"\/ca\/tutorials\/how-to-monitor-uptime-and-downtime\/\">monitor website uptime<\/a> and set up instant alerts. This way, you&#8217;ll be the first to know if your site is down &ndash; from a 522 error or anything else &ndash; and can fix it before it affects your audience.<\/p><p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error 522 is an HTTP status code indicating a connection timeout between a CDN service, like Cloudflare, and your website&#8217;s origin server. This error means Cloudflare tried to connect to your server to fetch content for a visitor, but the server took too long to respond. Common causes include an offline or overloaded origin server, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-fix-error-522\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":207,"featured_media":152795,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"What is Error 522 and how to fix it?","rank_math_description":"Error 522 is a connection timeout between Cloudflare and your server. Learn what causes it (server overload, firewalls, DNS) and how to fix it.","rank_math_focus_keyword":"error 522","_content_updated_date":"2025-11-06","footnotes":""},"categories":[22768],"tags":[],"class_list":["post-40659","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical-aspects"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/erro-522\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/erreur-522\/","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/error-522\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/mengatasi-error-522\/","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/error-522-beheben\/","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/come-risolvere-errore-522\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-fix-error-522\/","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/error-522\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/error-522\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/error-522\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/erro-522\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/40659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/207"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=40659"}],"version-history":[{"count":40,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/40659\/revisions"}],"predecessor-version":[{"id":152814,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/40659\/revisions\/152814"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media\/152795"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=40659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=40659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=40659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}