How to Fix Cloudflare Error 522: Connection Timed Out

Published: September 7, 2026
Last Updated: September 7, 2026
4 min read
Share:
How to Fix Cloudflare Error 522: Connection Timed Out
Is your website completely offline with a "Cloudflare Error 522: Connection Timed Out" message? Learn how to diagnose your origin server, verify your open ports, and restore your website instantly.
If you visit your website and are greeted by a generic Cloudflare screen displaying "Error 522: Connection Timed Out," your website is offline.

This error means that Cloudflare's network successfully routed the visitor's request, but your actual origin web server (where your files are hosted) failed to respond within 15 seconds. Cloudflare eventually gave up and dropped the connection.

This is almost always caused by a crashed web service (Apache/Nginx), a server firewall blocking Cloudflare's IPs, or a mismatched DNS record. Here is the exact checklist to diagnose your server and get your website back online.

Step 1: Verify the Origin Server Ports are Open

Before you dig into complex server logs, you must verify if your hosting server is actually listening for web traffic on the correct ports (Port 80 for HTTP, Port 443 for HTTPS).

  1. Find the direct public IP address of your origin server (available in your hosting provider's dashboard, like AWS, DigitalOcean, or cPanel).

  2. Go to the TraceMyIPOnline Open Port Scanner https://www.tracemyiponline.com/port-checker.

  3. Enter your origin server's IP address and scan Port 443.

If the scanner says the port is Closed or Filtered, your origin server's firewall (like UFW or iptables) is actively blocking incoming web traffic. If the scanner says Open, the port is fine, but the web service itself might be overwhelmed.

[Insert Your Data Here: Share a split-screen screenshot. On the left, show the Cloudflare Error 522 screen. On the right, show the TraceMyIPOnline Port Scanner revealing a "Closed" status on Port 443 for the origin server, proving where the breakdown occurred.]

Step 2: Check for DNS Record Mismatches

If you recently migrated your website to a new hosting provider, your Cloudflare DNS records might still be pointing to your old server's IP address. Cloudflare is trying to fetch data from a server that no longer hosts your site, resulting in a timeout.

  1. Navigate to the TraceMyIPOnline DNS Check Tool https://www.tracemyiponline.com/dns-lookup.

  2. Enter your domain name and scan for A Records.

  3. Log into your Cloudflare dashboard and go to the DNS tab.

  4. Compare the IP address listed in Cloudflare's "A Record" with the actual IP address provided by your current web host.

If they do not match, update the Cloudflare A Record with the correct origin IP address and wait 5 minutes for the proxy to update.

Step 3: Whitelist Cloudflare IPs on Your Firewall

Cloudflare acts as a reverse proxy. This means all traffic hitting your server appears to come from Cloudflare's IP addresses, not the actual visitors. If your server is running a strict security script (like Fail2Ban), it might mistake Cloudflare's high volume of requests for a DDoS attack and block them.

You must explicitly whitelist all Cloudflare IP ranges in your server's firewall. If you are using UFW on an Ubuntu server, log in via SSH and run this command for one of Cloudflare's main IPv4 blocks: sudo ufw allow from 173.245.48.0/20 to any port 443

(You will need to repeat this command for all active Cloudflare IP ranges, which are publicly listed on their website).

Step 4: Restart Your Web Server

If your ports are open, your DNS is correct, and Cloudflare is whitelisted, your actual web server software (Apache or Nginx) might have crashed due to a lack of RAM or a CPU spike.

Log into your server terminal and restart the service. For Nginx: sudo systemctl restart nginx For Apache: sudo systemctl restart apache2

Reload your website in an incognito window. The Error 522 should be resolved.

Frequently Asked Questions

What does Error 522 mean on Cloudflare?

Error 522 means "Connection Timed Out." It occurs when Cloudflare attempts to connect to your origin web server to load your website, but the origin server fails to respond within the allowed 15-second window.

Does Error 522 mean my website has been hacked?

No. Error 522 is a server connectivity issue, not a malware infection. It usually points to a misconfigured firewall, a crashed web service like Apache/Nginx, or a wrong IP address in your DNS records.

How do I bypass Error 522 as a visitor?

If you are just a visitor and not the website owner, you cannot fix Error 522. The issue is on the website's backend server. You can only try refreshing the page later or contacting the website owner via their social media channels to alert them of the outage.