Fixing Cloudflare Error 522 in WordPress

Cloudflare Error 522 in Wordpress

Cloudflare is undoubtedly one of the best content delivery network available to date. It does not only saves you bandwidth (if you are on a shared host that usually has limited bandwidth transfer per month) but provides you an additional layer of security for your blog or website. In fact, I’ve been a real fanatic of cloudflare the time I discovered it. The name itself really attracted me.

Cloudflare Content Distribution Network Cloud

Now that I decided to be online, I finally got the chance to use the service. After the launch of my own personal blog (this blog) last 2nd May 2015, everything seems to work great not until I am randomly getting an “Error 522: Connection Timed Out” page while browsing and managing this blog. At  first, I thought it was just a minimal downtime issue with my host but it became a major issue in the coming days.

Fixing Cloudflare Error 522: Connection Timed-Out

error522Original Image from Cloudflare Support Page

hostinger_0512aCritical Downtimes caused by Error 522: Connection Timed Out (Timezone: GMT +8)

Last May 12, Anturis uptime monitor reported that I suffered a 1 hour 2 minutes downtime and it was roughly followed by another 18 minutes in just the first half of the day. These figures were really not acceptable and unhealthy for any website. With this, I am forced to escalate the issue with Hostinger and Cloudflare support. Hostinger Philippines responded quickly and confirmed that there are no errors found in their end and I should contact Cloudflare for such issue. I believed because if it is a real server downtime, a “Server is down” error message should appear instead. I have read troubleshooting guide about the Error 522 in Cloudflare support page but nothing fix the error. Finally, I remembered that I added page rules on my cloudflare account so that much of the content of my blog will be served through cloudflare. I did this to make the server load even lower with the combination of WP Supercache plugin for WordPress because I am currently in a free plan with limited resources. I also tried turning Supercache plugin to on and off but it does nothing and seemed not the cause of the error. So, I decided to remove all the page rules I created in cloudflare and return to the basic settings. Voilà! The error was fixed! The error doesn’t appear again since I removed the rules. The rules I created were interfering to the main settings and caused redundancy in page caching.

July 17 Update. Hostinger suffers from frequent short downtime that may be causing the connection with Cloudflare to return a timed out error. Know more about the details at the Server Fault subtopic below.


If you do not have any page rules present, then you should look for another variable that is possibly causing the Cloudflare Error 522. Cloudflare listed the following as possible reasons why Connection Timed-Out appears (Go to Cloudflare Support):

  • Rate limiting incoming connections from CloudFlare’s IPs.
  • A process on the webserver is consuming all of one or more resources at the origin.
  • The domain is on a shared hosting platform where traffic or tasks for a separate domain on the same server is taking up one or more resources.
  • Network connectivity issues between CloudFlare and the origin web server.

Additional step you can do include:

Whitelisting Cloudflare IPs

Cloudflare IP addresses might be being blocked by your server. Try to whitelist the following IP ranges of Cloudflare:

You can do this on server side. It can be found anywhere termed as Firewall or something. If the issue still persists despite of removing page rules and whitelisting Cloudflare IPs, you may want to run a trace route. This method is somewhat more advance and not recommended for basic users. If you want to try it, please refer to cloudflare support page and possibly ask help from the Cloudflare guys. Do take note that if you are under a free plan, support responses will generally come 1-3 days after you posted a ticket. On the other hand, if you are just a basic user who does not prefer to read and understand the trace route output, keep reading the next paragraph.

Server Fault

Basically, this error is mostly prominent when the server you are in is overloaded. Meaning, your host somewhat having problems due to other websites in the same server (or your own website) is sucking up too much resources than the server can support. Another thing is that they might be overselling accounts that lead to service slowdown. Cloudflare in general does not have long patience and hence, does not tolerate slow response. When Cloudflare didn’t received any valuable response from the origin server (your hosting provider, in this case) within 15 seconds, it will just throw out the Error 522: Connection Timed Out page to anyone that tries to load a page of your website. That’s how stubborn Cloudflare is. This would generally will not happen if your website has a low traffic. So, high traffic websites are more susceptible. However, when this happens, there is nothing you can do but to contact your provider about the issue. Most of the hosting providers (especially cheap ones) will just deny your claim and insist that their service works fine. Others will advise you to upgrade to a higher plan. So, you have the options of either upgrading your present hosting or migrating to another – if you have the feeling that you do not get good service equivalent on what you pay.

Oops. I forgot. You have another option. It is to deactivate and leave Cloudflare at once. I guess this is not a smart choice anyway.

July 17 Update. A month ago, I started monitoring Hostinger’s performance with a fresh install of WordPress 4.2.2. The monitor was set to check the wordpress blog in 2 minute interval. I am a bit surprised that the server I am with encounter frequent short downtime. Although these downtime(s) don’t last longer than 2 minutes each time and do not occur daily, it greatly contributed to the 522 Connection Timed Out Error by Cloudflare. To find out if the error you have is on the server side, temporarily turn off Cloudflare and run your site purely on your hosting provider.

Essence of Cloudflare

If you are running a wordpress blog/website on a shared (or free) host, Cloudflare is a must have service for you. Not only it cuts the load in your server but also provides additional security. And, it is possible without paying a cent. Cloudflare is dedicated to provide FREE service for all basic users and can provide advance features for users who are willing to pay. For me, the basic package of cloudflare is enough for most of the websites and the pro features are for those websites that are high profile businesses, etc.

Did you encounter this error too? Please share your experience by commenting below. 🙂

Scroll to top