How to Fix Cloudflare Error 522 on a Flarum Website (Shared Hosting)

Like Comment

I have a tiny discussion community running with Flarum hosted on a shared hosting and I have a lot of experiences with 522 error code.
If you are running a Flarum forum on shared hosting and using Cloudflare for DNS and CDN, you may encounter the Error 522 – Connection Timed Out.

This error usually appears when visitors try to access your website through Cloudflare but the connection to your hosting server fails.

Below is a simple explanation of the root cause and how to fix it.

What Is Cloudflare Error 522?

A 522 error means:

Cloudflare was able to resolve your domain name, but it could not establish a connection to the origin server (your hosting server) within the allowed time.

In simple terms, Cloudflare cannot reach your web hosting server.

Root Causes of Cloudflare 522 Error

The most common causes include:

  1. Hosting Server Blocking Cloudflare

Many shared hosting providers have firewall rules that block certain IP ranges.
If Cloudflare IP addresses are not whitelisted, the connection will fail.

This is the most common reason for a 522 error.

  1. Incorrect DNS Records

If the A record in Cloudflare DNS points to the wrong IP address, Cloudflare will attempt to connect to the wrong server.

Example problem:

Domain pointed to an old hosting IP

Hosting IP changed after migration

  1. Server Timeout or Overload

If the hosting server is overloaded or slow to respond, it may not reply within Cloudflare’s timeout window.

Possible reasons:

Shared hosting resource limits

Too many PHP processes

High CPU usage

  1. Web Server Service Not Responding

Sometimes the web server (Apache or Nginx) stops responding due to configuration errors or hosting issues.

Since shared hosting users usually cannot manage the server directly, this must be handled by the hosting provider.

How to Fix Cloudflare Error 522

  1. Temporarily Disable Cloudflare Proxy

Go to Cloudflare DNS settings and change:

Proxy Status

Orange Cloud → Grey Cloud (DNS Only)

If the website works after this change, it means the hosting server is blocking Cloudflare traffic.

  1. Verify the Correct Hosting IP

Check your Cloudflare DNS settings and confirm the A record points to the correct hosting IP.

Example:

Type: A
Name: @
IP: Your hosting server IP

Also check the www record to make sure it points to the same location.

  1. Contact Your Hosting Provider

Ask your hosting support to:

Allow Cloudflare IP ranges

Remove firewall restrictions blocking Cloudflare

Cloudflare IP list:
https://www.cloudflare.com/ips/

  1. Check Cloudflare SSL Settings

In Cloudflare dashboard:

SSL/TLS Mode → Full

Avoid using Flexible SSL, as it can cause connection and redirect problems.

  1. Check Hosting Resource Limits

If you are using shared hosting, check your control panel for:

CPU usage

Memory limits

Concurrent processes

A server under heavy load may cause Cloudflare timeouts.

Final Thoughts

Cloudflare Error 522 usually happens when Cloudflare cannot reach your hosting server.

For websites running Flarum on shared hosting, the problem is often related to:

Hosting firewall blocking Cloudflare

Incorrect DNS records

Server resource limits

Once the hosting server allows Cloudflare connections and DNS settings are correct, the issue is typically resolved.

You might like

Avatar

About the Author: webmaster

Leave a Reply

Your email address will not be published. Required fields are marked *