There are a few reasons why you can see 502 Bad Gateway error. This means that could take a long time to fix it.
502 – WTF
You see error 502 when your WordPress server gets a wrong response for the desired page. The most common reason for 502 Bad Gateway is a long time to respond for the requested page. It can be caused by wrong server configuration, temporary server glitch or WordPress plugin with the loop in the loop in the loop in the loop… 🙂
Let’s take a look at few steps you can check when you see 502 Bad Gateway:
Reload the page
Please try to refresh the website after a few minutes. This may be temporary server pant. If your page is working again after reloading the page, it’s OK. Problem is when you see this error frequently – in this situation let’s read further.
Try to clear cache. Maybe the error is gone, but you see it because you are seeing cached page. So press Ctrl + F5 or even better – try to enter the website in incognito mode.
Firewall or CDN
If you are using FIrewall or CDN in your web hosting, please try to disable it. Then you are sure that your website is loaded using only files on your server.
If the problem is gone, you can contact with CDN support and try to fix this error so you will be able to enable CDN again.
The next step to check is your plugins. First of all please try to deactivate all plugins and visit your website. If this resolved your problem, you need to activate plugins one by one and localize “bad” plugin. Maybe there is an update for an invalid plugin. If not you can try to find an alternative plugin.
If none of the above advices can’t help you, please try to contact with hosting support. All decent hosting companies can quickly fix 502 Bad Gateway error.