{"id":40659,"date":"2021-12-03T05:56:07","date_gmt":"2021-12-03T05:56:07","guid":{"rendered":"\/tutorials\/?p=40659"},"modified":"2026-03-09T19:18:56","modified_gmt":"2026-03-09T19:18:56","slug":"how-to-fix-error-522","status":"publish","type":"post","link":"\/ng\/tutorials\/how-to-fix-error-522","title":{"rendered":"What is Error 522 and how to fix it?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Error 522 is an <strong>HTTP status code indicating a connection timeout between a CDN service, like Cloudflare, and your website&rsquo;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>To fix Error 522, you&rsquo;ll need to check that your server is online, verify your Cloudflare DNS settings match your server&rsquo;s IP, and check your server&rsquo;s firewall and KeepAlive settings.<\/p><p>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><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-causes-the-cloudflare-error-522\">What causes the Cloudflare Error 522?<\/h2><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197b629113\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-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\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/error-522-web-browser.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/error-522-web-browser.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/error-522-web-browser.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/error-522-web-browser.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\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\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ul class=\"wp-block-list\">\n<li><strong>Server overload<\/strong>. The origin server is overwhelmed with too many requests and can&rsquo;t respond to new ones, including Cloudflare&rsquo;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&rsquo;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&rsquo;s network might be blocking Cloudflare&rsquo;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&rsquo;t point to the correct IP address of your origin server. This sends Cloudflare&rsquo;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&rsquo;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>Please note that the problem almost always lies with your origin server, not with Cloudflare or the visitor&rsquo;s connection.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-fix-error-522-connection-timed-out\">How to fix Error 522 Connection timed out<\/h2><p>To fix a &ldquo;Connection timed out&rdquo; 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&rsquo;s firewall settings to confirm Cloudflare&rsquo;s IPs aren&rsquo;t blocked and check that KeepAlive is enabled.<\/p><p>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=\"How to Fix Error 522 | Cloudflare Error\" 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><p>\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\/ng\/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 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\/ng\/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><p class=\"important\"><strong>Important!<\/strong> Before you start, it&rsquo;s a good idea to <a href=\"\/ng\/tutorials\/is-this-website-down\">check if your website is down<\/a> for everyone using a tool like Uptrends and confirm that Cloudflare&rsquo;s system status is operational.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-1-check-if-the-web-server-is-working\">1. Check if the web server is working<\/h3><p>A common cause of Error 522 is an origin server that&rsquo;s offline or overwhelmed by too many HTTP requests. This often happens on shared hosting plans.<\/p><p>First, check if your origin web server is active. You can use a <a href=\"\/ng\/tutorials\/linux-ping-command-with-examples\">ping command on Linux<\/a> and Windows or <strong>traceroute<\/strong> on Windows to check the server&rsquo;s connectivity.<\/p><p>Next, check your site&rsquo;s resource usage. If your server is hitting its CPU or RAM limits, it won&rsquo;t be able to respond to new requests. Hostinger users can find this in their hPanel:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>Websites &rarr; Websites list &rarr; Dashboard &rarr; Hosting Plan &rarr; Resource Usage<\/strong>.<\/li>\n\n\n\n<li>Review the charts for:\n<ul class=\"wp-block-list\">\n<li><strong>CPU usage<\/strong>. Keep this under <strong>80%<\/strong> to avoid performance issues.<\/li>\n\n\n\n<li><strong>RAM usage<\/strong>. The amount of memory being used.<\/li>\n\n\n\n<li><strong>Processes<\/strong>. The total number of processes running on your account.<\/li>\n\n\n\n<li><strong>Input and output<\/strong>. The speed of data transfer.<\/li>\n<\/ul>\n<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197b629b71\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/public\" alt=\"Hostinger hPanel dashboard showing website hosting resource usage.\" class=\"wp-image-136041\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=1836,fit=scale-down 1836w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-resources-usage.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 1836px) 100vw, 1836px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\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\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you&rsquo;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 href=\"\/ng\/support\/1583459-how-to-upgrade-a-hosting-plan-at-hostinger\">upgrade your hosting plan<\/a> to get more resources.<\/li>\n<\/ul><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/ng\/web-hosting\" target=\"_blank\" rel=\"noreferrer 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\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-2-review-cloudflare-dns-settings\">2. Review Cloudflare DNS settings<\/h3><p>When you add your domain to Cloudflare, it imports your DNS records. The <strong>A<\/strong> Record (Address Record) is crucial, as it points your domain to your server&rsquo;s IP address. If this is wrong, Cloudflare sends requests to the wrong place.<\/p><p>First, find your server&rsquo;s correct IP address. For Hostinger users:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>hPanel &rarr; Websites &rarr; Websites list &rarr; Dashboard &rarr; Hosting Plan &rarr; Plan details<\/strong>.<\/li>\n\n\n\n<li>Find the Website IP address and copy it.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197b62acba\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-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\/public\" alt=\"Hostinger hPanel Plan details, with the Website IP address highlighted.\" class=\"wp-image-136042\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=2160,fit=scale-down 2160w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-hosting-plan-details-website-ip-address-highlighted.png\/w=2048,fit=scale-down 2048w\" sizes=\"auto, (max-width: 2160px) 100vw, 2160px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\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\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Next, check this IP against your Cloudflare settings:<\/p><ol class=\"wp-block-list\">\n<li>Log in to your Cloudflare dashboard and select your website.<\/li>\n\n\n\n<li>Click on the <strong>DNS<\/strong> app.<\/li>\n\n\n\n<li>Look for the <strong>A<\/strong> record for your main domain (for example, <strong>domain.tld<\/strong>).<\/li>\n\n\n\n<li>Check the <strong>Content<\/strong> value. This IP address must match the <strong>Website IP address<\/strong> from your hosting panel.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197b62b2c0\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-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\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/w=1051,fit=scale-down 1051w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/cloudflare-dns.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1051px) 100vw, 1051px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\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\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If the IP addresses don&rsquo;t match, click <strong>Edit<\/strong> on the <strong>A<\/strong> record in Cloudflare and update the <strong>Content<\/strong> field with the correct IP from your hosting panel. Click <strong>Save<\/strong>.<\/p><p>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\" id=\"h-3-look-through-other-web-server-settings\">3. Look through other web server settings<\/h3><p>If the server is online and DNS is correct, the issue might be with specific server settings.<\/p><p><strong>Enable KeepAlive<\/strong><\/p><p>Cloudflare uses the <strong>KeepAlive<\/strong> header to maintain persistent connections. If this is disabled on your server, the connection can fail. You can <a href=\"\/ng\/tutorials\/improving-website-performance-enabling-keep-alive\">enable the KeepAlive header<\/a> by adding the following code to your <strong>.htaccess<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;ifModule mod_headers.c&gt;\n   Header set Connection keep-alive\n&lt;\/ifModule&gt;<\/pre><p><strong>Allow Cloudflare IPs<\/strong><\/p><p>Sometimes, your server&rsquo;s firewall or security rules might accidentally block Cloudflare&rsquo;s IP addresses, flagging them as malicious. You must whitelist them. You can find the <a href=\"https:\/\/www.cloudflare.com\/ips\">full list of Cloudflare IPs<\/a> on their official site.<\/p><p>Hostinger users can easily add these IPs using the IP Manager:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>hPanel &rarr; Websites &rarr; Websites list &rarr; Dashboard &rarr; Advanced &rarr; IP Manager<\/strong>.<\/li>\n\n\n\n<li>Under <strong>Allow an IP Address<\/strong>, add Cloudflare&rsquo;s IP ranges and click <strong>Add<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e197b62b95f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2152\" height=\"916\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/public\" alt=\"Hostinger hPanel's IP Manager interface in the Advanced section.\" class=\"wp-image-136043\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=2152,fit=scale-down 2152w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/12\/hpanel-websites-advanced-ip-manager.png\/w=2048,fit=scale-down 2048w\" sizes=\"auto, (max-width: 2152px) 100vw, 2152px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\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\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Alternatively, you can add <strong>allow from<\/strong> rules for each Cloudflare IP in your <strong>.htaccess<\/strong> file.<\/p><p><strong>Temporarily disable Cloudflare<\/strong><\/p><p>If nothing else works, try pausing Cloudflare temporarily to see if the error disappears. This helps confirm if the issue is related to Cloudflare or a problem with your server.<\/p><p>If the site works with Cloudflare paused, the issue is in the connection between the two; if it&rsquo;s still down, the problem is with your origin server.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-do-i-know-if-error-522-has-been-fixed\">How do I know if Error 522 has been fixed?<\/h2><p>You&rsquo;ll know Error 522 has been fixed <strong>when your website loads normally in your browser without the &ldquo;Connection timed out&rdquo; message<\/strong>.<\/p><p>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&rsquo;s accessibility from different locations.<\/p><p>If the site loads successfully, and you&rsquo;ve confirmed your server isn&rsquo;t overloaded and Cloudflare&rsquo;s IPs are whitelisted, the error is resolved.<\/p><h2 class=\"wp-block-heading\" id=\"h-troubleshooting-other-cloudflare-errors\">Troubleshooting other Cloudflare errors<\/h2><p>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><strong>Error 520: Web server is returning an unknown error<\/strong><\/p><p>A <a href=\"\/ng\/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>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&rsquo;s response headers and cookies to check they are formatted correctly and not too large.<\/p><p><strong>Error 521: Web server is down<\/strong><\/p><p>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&rsquo;s requests.<\/p><p>To fix <a href=\"\/ng\/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&rsquo;s IP addresses are whitelisted.<\/p><p><strong>Error 524: A timeout occurred<\/strong><\/p><p>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>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&rsquo;s resource usage and logs to identify and optimize that slow process.<\/p><h2 class=\"wp-block-heading\" id=\"h-keep-your-hosting-environment-running-smoothly\">Keep your hosting environment running smoothly<\/h2><p>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&rsquo;ve restored the link between your server and Cloudflare, making your site accessible to visitors again.<\/p><p>To prevent this and other issues from happening in the first place, it&rsquo;s important to regularly check your server&rsquo;s resources, keep DNS settings accurate, and confirm your firewall rules are correct.<\/p><p>We also recommend you to <a href=\"\/ng\/tutorials\/how-to-monitor-uptime-and-downtime\">monitor website uptime<\/a> and set up instant alerts. This way, you&rsquo;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>\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&rsquo;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. To fix Error 522, you&rsquo;ll need to check that [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/how-to-fix-error-522\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":207,"featured_media":144643,"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","footnotes":""},"categories":[22630],"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":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/error-522","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/error-522","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/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":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/error-522","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/erro-522","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/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}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/40659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/207"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=40659"}],"version-history":[{"count":37,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/40659\/revisions"}],"predecessor-version":[{"id":144642,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/40659\/revisions\/144642"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/144643"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=40659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=40659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=40659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}