How to Deal With Cloudflare 502 Error.

How to Deal With Cloudflare 502 Error. Cloudflare is one of the popular Content Delivery Networks and It is also free. Many of you are using it to speed up your blog performance. I am also using it for my blog. But in many cases, you might notice the 502 error while browsing your website. This is the most common issue for Cloudflare users.

Sometimes it comes randomly but sometimes it is too frequent. Errors always are so annoying and people don’t want to see it. There are many reasons for Cloudflare 502 error. In this post, I am going to show you the most common reasons for this error and how to deal with it.

What is 502 Error?

Let’s first understand what is 502 error. 502 error usually occurs when Cloudflare unable to connect your origin server. For example, you are using Siteground and using Cloudflare. If Cloudflare unable to connect your origin server i.e. Siteground than it throws the 502 error. Check out the screenshot below:

cloudflare 502 error
Image Credit:

How to Deal with Cloudflare 502 Error?

There are many reasons for this error. We simply cannot work on a single aspect as it can happen in multiple ways.  Let’s try to find out the reasons behind it.

#1. Look out for bad plugins

Sometimes a bad plugin can cause conflict between Cloudflare and your origin server which might throw the 502 error. So, Deactivate all the plugins and activate them one by one to see if any of your plugins are creating the issue.

#2. Clear your browser’s cache and flush your DNS.

Sometimes cleaning your browser’s cache can resolve the issue. Delete all of your browsing data and cache. You can also flush your DNS as well. To do this Open your command prompt by running it as administrator. Now run the following commands:

  • Ipconfig/flushdns
  • Ipconfig/release
  • Ipconfig/renew

These command sequence will clear your PC’s DNS resolver cache.

#3. Check your Security plugin and Firewall settings

Sometimes security plugins can create this error. If you are using a security plugin like Wordfence, ALL in One WP security etc. Check their setting and also look at the firewall settings. Sometimes they can create conflict and block Cloudflare to access your server.

If you are using the jetpack plugin and activated its security option then you might have to whitelist the Cloudflare ips.  To do this you have to follow some simple steps. First get the Cloudflare IP’s here. Just copy all the IPV4 IP addresses.

Jetpack Security Settings

Go to your Jetpack settings and click the security option (Check The image above). Scroll down and open the Brute Force settings. Here you have to put all the ips of Cloudflare to whitelist them. By doing this Jetpack won’t block Cloudflare ips to access your origin server.

#4. A bad server configuration

A bad web hosting can also create this error. Some of you choose a poor web hosting company and use Cloudflare to speed up your website. But in reality, it will create a lot of issue with your website and 502 error is also one of them.

Always go with a reliable web hosting provider. I highly recommend using Siteground or Hawkhost as they are officially Cloudflare partners and provides your reliable and excellent hosting services.

#5. You have just activated the Cloudflare

If you have just installed Cloudflare then you might have to wait for 24 to 48 hours to propagate the DNS. If you still see the error after 48 hours then follow the above steps to sort out the issue.

#6. You have issues with your SSL

Sometimes if you don’t have properly install and activated the SSL on your server then it might throw out the 502 error. If you are using Letsencrypt SSL then keep your Cloudflare Crypto setting to FULL and If you are using Paid SSL like Comodo then keep your Crypto setting to Full Strict.

You can take the help of your web hosting provider to install and activate the SSL on your server.

#7. Disable the Railgun settings

This is not the common reason of Cloudflare error. But in many cases disabling the Railgun completely from your Cloudflare settings can stop the 502 error. If all the above points are not working for you than you might try this out.

Over to you

Cloudflare is definitely a great way to speed up your website. However, A 502 error can be very annoying for you. I hope in this post, I am able to help you to solve out the issue. If you have any questions or queries ask me in the comment section. If you like the post, please share it on your social networks.







One response to “How to Deal With Cloudflare 502 Error.”

  1. Robin Khokhar Avatar

    Hi Vishwajeet,
    Thanks for sharing a post on 502 error on cloudflare, which almost every webmaster goes through.
    Keep up the good work.

Leave a Reply

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