Skip to content
Home » How to fix 502 Bad Gateway error in WordPress?

How to fix 502 Bad Gateway error in WordPress?

502 bad gateway error

Having a 502 Bad Gateway error on your WordPress website is quite annoying and tricky to solve. Many factors can cause this error, so solving it becomes challenging and time-consuming some times. This error majorly occurs due to miscommunication between the edge server, which acts as proxy, and origin server, also known as an upstream server. Fixing this error should be your priority because it can disturb the operations of your website.   

Let’s have a look at how you can fix this error immediately. 

Reloading the website to solve Bad Gateway error:  

Sometimes, your server has low resources, and too many users come online and consume those resources. With this, your server fails to respond to all the users at a time, and hence this error occurs. Whenever you face this error, make sure to reload your website after some time and see if the problem gets solved.  

Clear the cache and cookies: 

Whenever you visit any website, your browser saves some cookies and cache of that site. So, if you are facing this problem again and again, it could be due to the fact that your browser is showing the older version of the website. Make sure to clear the cache and check if this fixes the problem for you.  

Check CDN and Website firewall to fix 502 Bad Gateway error: 

Content Delivery Network (CDN) service and Website Firewall can play a crucial role in displaying this error. If you are using CDN service, try to disable it. When you do this, the additional layer between your browser and the hosting server will be removed, and now your website will be directly loaded from your server. If the problem gets fixed by disabling the CDN, contact your CDN service provider, and they will fix the issue for you.  

Sometimes weak firewall configurations can also block requests from CDN by thinking it as an attack on your website resulting in this error. Recheck your firewall configuration and check if it makes your website running again. 

Disabling Plugins and changing themes:  

It is very much possible that the problem you are facing is due to one of your installed plugins. Sometimes when you add a plugin, its coding structure can clash with your theme. All you have to do is to disable all of your plugins. After disabling them, try to reload the website. If the problem solves, it means that one of your plugins is causing it. Now, you have to reactivate your plugins one by one to see which plugin is causing the problem. Once you get the name of your flawed plugin, you can either look for its replacement or try to contact the customer support of that plugin.  

Sometimes your theme can cause this problem. Change the theme of your WordPress website and see if it solves the problem. 

Read also: Best free and premium WordPress themes 

Check for recent DNS changings: 

Did you recently change host servers or your IP address? Well, this could be the problem for 502 Bad Gateway error.  

Wait for a few hours until these changes take full effect. Try to check your website after some time and see if it fixes the problem.  

Contact your web hosting provider: 

If none of the above tricks work, you have to contact your hosting provider. It is quite possible that the servers of your hosting providers are misconfigured. Ask them that you have taken these steps, but still, the problem persists. They will fix it for you. 

Whenever you face 502 Bad Gateway error, fixing it should be your priority because it can stop the operation of your WordPress website. We hope that one of the above fixes has solved your problem. Let us know in the comment section below that which trick helped you in getting your site back online.