How to Solve Error 502 Bad Gateway on Website

This time we will discuss how to resolve the 502 Bad Gateway error on a website. 502 Bad Gateway is an error that is not only found on WordPress, but also other websites with different platforms, such as Shopify or Drupal.

This error occurs when the gateway or proxy receives an invalid response from the server. So the browser will display a 502 error, and visitors will not be able to access the website.

About the causes of 502 Bad Gateway. Here are some of them:

  1. Need to clear the browser cache.

  2. Plugins & themes that need to be updated.

  3. Log Error.
  4. Problematic DNS.

For how to resolve 502 Bad Gateway:

This problem is generally caused by the server, but not infrequently due to problems from the side of your own website. In this article, we will discuss the causes and solutions to fix 502 bad gateway so that your website can be accessed again.

  • Clear Browser Cache

You need to do this to make sure the error that appears is not coming from the error page stored on your browser.
. How to Clear Your Browser Cache - KB

  • Using another browser

When clearing the browser cache doesn't solve the problem, try switching to a different browser. You can also try switching to incognito mode. This can be done to determine if the problem is with the browser itself.


  • Problems with DNS Records

Another cause of the 502 Bad Gateway error is a DNS problem, i.e. the domain doesn't point to its destination IP. The error often occurs when you move your website. Therefore, you need to wait until the next 1x24 hours to resolve it.


  • Checking on Hosting Services

This problem is more commonly experienced by shared hosting users, where there is a script that will stop requests from querying your website. This is done to prevent the server from going down and affecting other users with the same server.


  • Checking Plugins and Templates in Wordpress

Your plugins and templates can be the source of the 502 Bad Gateway error. Scripts and queries from your website can be stopped by the server system due to a script in WordPress that is problematic. The source of these problems is often found in plugins or templates that you install.

To resolve this, you can check by deactivating all plugins, then try accessing your website again before making sure the error is still there or not.

To deactivate a plugin, please login to the Wordpress Dashboard first then select the Plugins > Installed Plugins menu. Then, put a check mark on all plugins, select Deactivate on the dropdown menu and click Apply. Visualization of further explanation you can see in the image below.

 

Next, access the plugins folder by going to the main directory of your WordPress installation, then open the wp-content folder.

If the error no longer appears, please reactivate your plugins one by one through the WordPress dashboard. Don't forget to rename the plugins folder that you previously changed.

 

  • Checking the Error Log

If the 502 bad gateway error on your website appears after you've made certain changes, then it's most likely those changes that are causing the error. Looking at your error logs is one way to find out.

To enable error logging in wordpress, you can simply add the following lines to your wp-config.

define( 'WP_DEBUG', true ); 

define( 'WP_DEBUG_LOG', true ); 

define( 'WP_DEBUG_DISPLAY', false );

To see the entry changes, you can access the wp-contents/debug.log file to analyze the errors. 

Here are some ways to resolve 502 Bad Gateway on your website. As we explained earlier, the error is usually not caused from the client side, but because of problems on the server.

In addition, plugins or templates with poor code structure can also be the main cause of the error.

 

If the problem is not resolved using some of the methods described above. You can contact our Technical Support team via Email at support@exabytes.co.id 

 

Good luck and thank you.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.