Skip to main content

How to Troubleshoot Cloudflare Error 522: Connection Timed Out

Cloudflare Error 522 occurs when Cloudflare is unable to establish a connection with your origin server because the server took too long to respond. This error indicates a communication failure between Cloudflare and the server where your website...

Cloudflare Error 522 occurs when Cloudflare is unable to establish a connection with your origin server because the server took too long to respond. This error indicates a communication failure between Cloudflare and the server where your website files are hosted.

Before you begin

You will need:

  • Access to your Cloudflare account.

  • Access to your Hostek hosting control panel (such as cPanel, WHM, or Windows Control Panel).

  • The ability to verify your server's status and firewall settings.

Check the origin server's availability

The most common cause of a 522 error is that the origin server is offline or not responding to requests.

  1. Verify that your website is hosted on a live server.

  2. Check your hosting control panel to ensure the server or the specific account is active.

  3. If you have access to the server via SSH or a management console, attempt to ping the server's IP address or use curl to request the local site.

If the server is unresponsive, contact Hostek support to verify the status of your hosting environment.

Check for firewall blocks

A 522 error often occurs because a firewall is blocking the IP addresses that Cloudflare uses to connect to your server.

  1. Identify the IP addresses Cloudflare uses to connect to your server. You can find the official list of Cloudflare IP ranges in the Cloudflare documentation.

  2. Ensure that your server's firewall (such as iptables, firewalld, or a hardware firewall) allows incoming traffic from these specific IP ranges.

  3. If you use a security plugin or a Web Application Firewall (WAF) on your server, ensure it is not flagging Cloudflare's IP addresses as malicious.

Verify the server's resource limits

If your server is overloaded, it may be unable to process incoming connections from Cloudflare in a timely manner.

  1. Check your hosting control panel to see if your account has reached its CPU, memory, or entry process limits.

  2. If resources are exhausted, you may need to optimize your site or upgrade your hosting plan.

  3. Restart your web server (e.g., Apache or Nginx) via your control panel to clear hung processes.

Confirm the correct origin IP address

If you have recently changed your hosting or moved your site, Cloudflare may be attempting to connect to an old or incorrect IP address.

  1. Log in to your Cloudflare account.

  2. Navigate to the DNS section.

  3. Locate the A or CNAME record for your domain.

  4. Ensure the IP address listed matches the current IP address provided by Hostek for your account.

How to verify the fix

To confirm the issue is resolved, perform the following checks:

  • Clear your browser cache or attempt to load the site in an Incognito/Private window.

  • Check the site using a different device or network connection.

  • Verify that the site loads without the Cloudflare 522 error page.

Limitations

  • This procedure does not resolve issues caused by incorrect DNS records; ensure your DNS records are correct before troubleshooting the connection.

  • This article does not cover "Error 521: Web Server Is Down," which typically indicates a different type of connection failure.

  • If your server is behind a secondary proxy or a different firewall service not managed by Hostek, you must contact that provider to allow Cloudflare's IP ranges.

Did this answer your question?