Error 522 is Cloudflare’s way of saying, “I tried to talk to your server, but it’s giving me the silent treatment.” The result? Your visitors hit a wall. Your site feels broken. And if you’re running a business, that means lost conversions and angry users.
This guide covers exactly how to fix Error 522, why it happens, and how to make sure it doesn’t come back.
What Is Error 522 (Cloudflare Connection Timed Out)?
Cloudflare Error 522 happens when Cloudflare successfully reaches your origin server’s IP address, but the server fails to respond before the connection times out. The connection is established, but no data is exchanged.
This is different from an unreachable server or bad DNS configuration. With HTTP error 522, Cloudflare can get to your server, but your server doesn’t respond in time.
What Causes Error Code 522?
You’re not dealing with just one issue here. A 522 error can be caused by multiple things:
1. Origin server is too slow or overloaded
If your hosting server is maxed out, under-provisioned, or just plain down, Cloudflare won’t get the reply it needs.
2. Firewall or security software is blocking Cloudflare
Your server might be configured to block or rate-limit Cloudflare’s IPs. Some firewalls see Cloudflare as suspicious traffic.
3. Incorrect DNS settings
If your A record in Cloudflare is pointing to the wrong IP address, Cloudflare will wait for a response that never arrives.
4. KeepAlive is disabled
Cloudflare expects persistent HTTP connections. If your server closes connections too soon, the result is a 522 connection timed-out error.
5. Network routing problems
Sometimes the route between Cloudflare’s data centers and your server gets messed up. This could be a provider-level issue.
How to Fix Error 522 (Full Guide)
Let’s fix it. Here’s a full list of steps to troubleshoot and resolve Cloudflare Error 522 on any host, including instructions for users hosted on Rapyd Cloud.
✅ Step 1: Check if your origin server is online
Start by making sure your server is actually responding.
If you’re on Rapyd Cloud, log in to your dashboard and check your server’s status. You can also SSH in directly or use our one-click console to ping your site.
ping yourdomain.com
curl -I yourdomain.com
If there’s no response or a timeout, restart the server or check for any pending software updates, crashes, or disk space issues.
✅ Step 2: Whitelist Cloudflare’s IPs in your firewall
Cloudflare maintains a list of IPs you should always allow through.
With iptables:
iptables -I INPUT -p tcp -m multiport --dports http,https -s CLOUDFLARE_IP -j ACCEPT
Repeat for each IP in this list:
https://www.cloudflare.com/ips
On Rapyd Cloud, if you’re using our built-in firewall, go to the Firewall section in the dashboard and add Cloudflare’s IP ranges under “Allowed Sources”.
Make sure to reload or restart the firewall afterward.
✅ Step 3: Check your DNS records in Cloudflare
Go to your Cloudflare dashboard → DNS tab.
- Look for the A record pointing to your root domain (@)
- Make sure the IP matches your current origin server’s public IP
If you’re unsure, you can check your server’s IP using:
curl ifconfig.me
Update the A record if it’s pointing somewhere old or incorrect.
✅ Step 4: Make sure KeepAlive is turned on
Cloudflare requires persistent HTTP connections.
For Apache:
Open your configuration file and enable KeepAlive:
KeepAlive On
For NGINX:
Make sure this is in your config:
keepalive_timeout 65;
Then restart your web server:
sudo systemctl restart apache2
# or
sudo systemctl restart nginx
✅ Step 5: Check for server load issues
If your server is struggling to keep up, timeouts are inevitable.
Use the following commands to check CPU, memory, and disk usage:
top
free -m
df -h
Rapyd Cloud users can view real-time CPU and RAM stats in the Hosting dashboard. If usage is consistently high, consider upgrading your plan or turning on autoscaling.
✅ Step 6: Run a traceroute to detect network issues
Traceroute will help you see if the problem is happening somewhere between Cloudflare and your server.
traceroute www.cloudflare.com
If the trace breaks mid-path or shows significant delays, the issue might be network-related and outside your control. Contact your hosting provider or Cloudflare support if it’s persistent.
✅ Step 7: Try RapydCDN instead of Cloudflare
Cloudflare is powerful, but it’s not always the right fit for every website.
If you’re tired of dealing with 522 errors, consider using RapydCDN, our free global CDN that integrates natively with Rapyd Cloud hosting. It’s fast, reliable, and designed to reduce errors like this by keeping traffic closer to your users and your server under less stress.
You get the benefits of content delivery without the configuration headaches.
Wrapping Up
HTTP error 522 is a common Cloudflare error that means your server is too slow or unreachable, even though Cloudflare can connect to it. Fixing it means checking your server’s health, DNS, firewall rules, and connection settings.
And if you want fewer moving parts, less complexity, and built-in performance tools, Rapyd Cloud gives you fast hosting plus a free global CDN (RapydCDN) designed to eliminate connection errors before they ever show up.
FAQs About Cloudflare Error 522

What’s the difference between error 522 and other Cloudflare errors like 521 or 524?
522 means the origin server didn’t respond in time
521 means the connection was refused
524 means a successful connection was made, but it took too long to process the request
Can Cloudflare error 522 be caused by plugins or security apps?
Yes. Web application firewalls (WAFs), security plugins like Wordfence, and even server-side anti-DDoS tools can mistakenly block or throttle Cloudflare requests.
Is error 522 always a server issue?
Most of the time, yes. Cloudflare connects successfully, but your server doesn’t reply. This could be due to traffic spikes, misconfiguration, or bad routing.
Will RapydCDN solve this problem permanently?
In many cases, yes. RapydCDN removes the need for third-party layers that can block or slow down traffic. It connects directly to our hosting infrastructure, reducing the risk of connection issues.
Can I monitor for 522 errors automatically?
Yes. Use uptime monitoring tools like UptimeRobot or Rapyd Cloud’s built-in performance insights to get alerts when your server goes silent.