Nov 20, 2025
Astari S. & Ariffud M.
6min Read
Error 522 is an HTTP status code indicating a connection timeout between a CDN service, like Cloudflare, and your website’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’ll need to check that your server is online, verify your Cloudflare DNS settings match your server’s IP, and check your server’s firewall and KeepAlive settings.
Here’s a quick summary of the error:
| Error code | Error 522 |
| Error type | Server error |
| Error variation | Connection timed out |
| Error causes | Server overload Firewall blocking Cloudflare IPs Incorrect DNS KeepAlive disabled |

Please note that the problem almost always lies with your origin server, not with Cloudflare or the visitor’s connection.
To fix a “Connection timed out” error 522, first, check if your web server is online and not overloaded. Then, verify that your Cloudflare DNS settings point to the correct server IP address. Finally, review your server’s firewall settings to confirm Cloudflare’s IPs aren’t blocked and check that KeepAlive is enabled.
If you prefer a visual guide, our video tutorial walks you through fixing Error 522:
Important! Before you start, it’s a good idea to check if your website is down for everyone using a tool like Uptrends and confirm that Cloudflare’s system status is operational.
A common cause of Error 522 is an origin server that’s offline or overwhelmed by too many HTTP requests. This often happens on shared hosting plans.
First, check if your origin web server is active. You can use a ping command on Linux and Windows or traceroute on Windows to check the server’s connectivity.
Next, check your site’s resource usage. If your server is hitting its CPU or RAM limits, it won’t be able to respond to new requests. Hostinger users can find this in their hPanel:

If you’re hitting the limits, it will slow your site and cause this error. To fix this:

When you add your domain to Cloudflare, it imports your DNS records. The A Record (Address Record) is crucial, as it points your domain to your server’s IP address. If this is wrong, Cloudflare sends requests to the wrong place.
First, find your server’s correct IP address. For Hostinger users:

Next, check this IP against your Cloudflare settings:

If the IP addresses don’t match, click Edit on the A record in Cloudflare and update the Content field with the correct IP from your hosting panel. Click Save.
DNS changes can take up to 24 hours 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 Full to prevent other issues.
If the server is online and DNS is correct, the issue might be with specific server settings.
Enable KeepAlive
Cloudflare uses the KeepAlive header to maintain persistent connections. If this is disabled on your server, the connection can fail. You can enable the KeepAlive header by adding the following code to your .htaccess file:
<ifModule mod_headers.c> Header set Connection keep-alive </ifModule>
Allow Cloudflare IPs
Sometimes, your server’s firewall or security rules might accidentally block Cloudflare’s IP addresses, flagging them as malicious. You must whitelist them. You can find the full list of Cloudflare IPs on their official site.
Hostinger users can easily add these IPs using the IP Manager:

Alternatively, you can add allow from rules for each Cloudflare IP in your .htaccess file.
Temporarily disable Cloudflare
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.
If the site works with Cloudflare paused, the issue is in the connection between the two; if it’s still down, the problem is with your origin server.
You’ll know Error 522 has been fixed when your website loads normally in your browser without the “Connection timed out” message.
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’s accessibility from different locations.
If the site loads successfully, and you’ve confirmed your server isn’t overloaded and Cloudflare’s IPs are whitelisted, the error is resolved.
For specific Cloudflare errors like 520 (unknown error), check for server application crashes and incompatible headers; for 521 (web server is down), verify that your origin server is active and not blocking requests; and for 524 (connection timed out), investigate long-running server processes.
Error 520: Web server is returning an unknown error
A 520 error often results from a crash in the web server application or from response headers that are incompatible with Cloudflare.
To troubleshoot it, first, double-check that your Cloudflare DNS records are correct. If they are, try temporarily disabling your .htaccess file to see if a rule is causing the problem. You can also inspect your server’s response headers and cookies to check they are formatted correctly and not too large.
Error 521: Web server is down
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’s requests.
To fix Error 521, 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’s IP addresses are whitelisted.
Error 524: A timeout occurred
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.
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’s resource usage and logs to identify and optimize that slow process.
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’ve restored the link between your server and Cloudflare, making your site accessible to visitors again.
To prevent this and other issues from happening in the first place, it’s important to regularly check your server’s resources, keep DNS settings accurate, and confirm your firewall rules are correct.
We also recommend you to monitor website uptime and set up instant alerts. This way, you’ll be the first to know if your site is down – from a 522 error or anything else – and can fix it before it affects your audience.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.