Do you want to fix the 502 bad gateway error on your WordPress website? This error is very upset because it can be due to many different things. This means that it may take some time to troubleshoot the 502 Bad Gateway error. In this article, we will describe you how to fix 502 bad gateway error in WordPress.
What is a 502 Bad Gateway Error in WordPress?
502 bad gateway error triggers when your WordPress hosting server receives invalid feedback for the requested page.
Bad gateway error is one of the common WordPress errors you can get on your site. This can happen for a variety of reasons and depending on your server the error message may also be slightly visible.
When you visit any website, your browser sends a request to the website hosting server. The hosting server then finds the website page and sends it back to its browser with the status code.
Generally, you will not see this status code. However, the status code is displayed with an error message. Examples of some errors:
404 not found,
503 service unavailable,
403 forbidden error,
The most common reason for a 502 bad gateway error occurs when your request for server is too long. This delay can be a temporary disturbance due to high traffic. It may also be a disturbance due to a poorly coded WordPress theme or plugin. Last but not least, this may also be due to a server misconfiguration.
See some below example how to fix 502 bad gateway error in WordPress.
Fix 502 Bad Gateway Error
This error usually occurs when your server does not find the reason for an invalid response. This means that unless we find problems, we will try different troubleshooting steps.
Ready to start troubleshooting.
1: Reload Your Website
Sometimes your server may take more time to respond due to traffic or less server resources. In that case, the problem may disappear automatically in a few minutes. You should try to reload the web page to see if this was the reason or not.
If this fixes error, then you do not need to read further. However, if you frequently see this error, then you need to continue to read because there may be something else that needs fixing.
2: Clear the Browser Cache
Your browser is showing you the error page from the cache. Even after the problem is fixed, you will see 502 error as the browser is loading your website from the cache.
You may also read our article on “WordPress posts returning 404 error“.
To fix cache issue, Windows / Linux operating system can press the Ctrl + F5 button and Mac OS press CMD + Shift + R button to refresh page. You can also manually delete the cache from your browser settings.
You can also use a different browser or private browser to troubleshoot, if the problem is occurring from browser cache. If you see error in all browsers, then continue troubleshooting.
3: Disable the CDN or website Firewall
If you are using a CDN service to secure browse the web or a website firewall on your website, then you will need to disable the CDN temporarily or website firewall off. After this, your website will now be fully loaded from your server and if the problem was due to the CDN / firewall service, it will now be resolved.
Contact your CDN service provider or website firewall service provider for support. Once the problem is resolved, you can proceed and enable the CDN again.
4: Update your WordPress Themes and Plugins
First of all, you will need to deactivate all WordPress plugins via FTP. After that, to see if the error has been solved, visit your website. If one of your plugins was causing issue. Now you need to activate all plugins one by one unless you reproduce the error. This will help you find the plugin responsible for the error.
You can find an optional plugin or contact the plugin developer for support.
If deactivating the plugin does not solve your problem, then you need to check your WordPress theme. You will need to switch WordPress Theme through phpMyAdmin.
After switching the theme to the default WordPress theme, go to your website to see if it’s working or not. If you are still showing the error, continue troubleshooting.
5: Check your Hosting Server
If the above mentioned troubleshooting steps have failed, it is possible that this is a problem with your hosting server.
You need to contact your hosting provider’s support team and let them know about this issue. You can also mention all the steps you have taken for fix the issue. They are able to fix the issue immediately if it is caused by a server misconfiguration.
I hope above step helped you learn how to fix the 502 bad gateway error in WordPress. You may also want to check out our full WordPress troubleshooting guide for step-by-step instructions to Fix the 504 Gateway Timeout Error in WordPress.