Table of Contents
This tip is about the how To Fix ‘502 Bad Gateway Error’ issue. So read this free guide, How To Fix ‘502 Bad Gateway Error’ issue step by step. If you have query related to same article you may contact us.
How To Fix ‘502 Bad Gateway Error’ issue – Guide
A 502 Bad Gateway Error means that the web server you are connected to is acting as a proxy to forward information from another server, but has received an incorrect response from that other server. The error is called a 502 because this is the HTTP status code that the web server uses to describe this type of error. It is possible that the server is overloaded or that there are network issues between the two servers and it is just a temporary problem. It is also possible that there is a misconfigured firewall or a programming error, and the problem will not be fixed until these issues are resolved.
As with 404 errors, website designers can customize the appearance of a 502 error. As a result, you may see 502 pages that look different on different websites. In the vast majority of cases, this is a server-side error that you can’t do anything about. Sometimes it’s a temporary error, sometimes it’s not. Still, there are a few things you can try on your side.
Fix the ‘502 Bad Gateway Error’ issue
reload the page
The first solution is quite simple – wait a minute or two and refresh the page you are on. In many cases, the error comes from a sudden increase in traffic. So a simple page refresh will usually do the trick. trick. For a shortcut, Windows users can press F5 or CTRL+F5, while Mac users can press CMD+R.
You can also try to check if the site is offline using an online tool such as Website Planet or Host Tracker. This will help identify whether a server or client issue causes the error.
Clear browser cache
If the error persists, it is possible that your browser cache has saved outdated and corrupt files. In this case, clearing your browser cache can fix an HTTP 502 Bad Gateway error.
Keep in mind that removing the cache can risk losing important browser data, including bookmarks and preference settings. To avoid this, simply export your browser data and import it back later.
Try it in incognito mode
Accessing the website using incognito mode is also a good idea as it helps you determine if the http 502 error message appears due to a browser related issue. To open an incognito window, click on the three dots button on the browser screen and choose New Incognito Window.
If the error does not occur in incognito mode, the problem could be caused by a browser extension. With that in mind, try disabling your add-ons or extensions gradually. Once you delete what is causing the error, you will be able to access the website.
If disabling extensions doesn’t help, try opening a different browser. For example, if you are currently on Google Chrome, try using Mozilla Firefox. When the page loads normally in the new browser, your previous browser may be causing the error. To resolve the issue, try deleting and reinstalling the faulty browser.
free DNS
The 502 Bad Gateway error can also occur due to DNS issues like incorrect IP addresses and unresponsive DNS servers. In this case, flushing the DNS cache might be the answer. This method works similarly to clearing the browser cache. It will remove bad files from your DNS server.
Temporarily changing your DNS servers is another step you can take. By default, your DNS servers are assigned by your ISP. However, you can always change it to a third-party server like Google’s public DNS.
Test on another device
If none of the above solutions fixed the HTTP 502 error, test the connection on another computer or mobile device, preferably connected to a different network.
Try restarting your PC and other network equipment. To do this, turn off your computer and unplug the wireless router. Wait a moment and connect them again. This step helps you decide if the error is related to your network equipment or if the problem lies elsewhere.
Check the error log
When a 502 Bad Gateway error occurs after a specific change or update, the fault may be with the server itself. The best approach to this problem is to check your error log. Typically, your hosting service gives you access to enable site error logging via an admin panel. You can also enable error logging on your WordPress site by adding the following lines to wp-config.php:
define( ‘WP_DEBUG’, true );define( ‘WP_DEBUG_LOG’, true );define( ‘WP_DEBUG_DISPLAY’, false );
All errors generated will appear in the wp-contents/debug.log file, allowing you to detect which ones are causing a 502 Bad Gateway error.
Check plugins and themes
Sometimes faulty plugins or themes can be one of the reasons for a 502 Bad Gateway error. This is because poorly coded plugins and themes can conflict with each other. When this happens, your server will stop all scripts and queries on your site, making it inaccessible.
For some websites, the problem usually comes from the cache or security plugins. There is a good chance that these plugins will block communication between servers, causing the error to persist. If you don’t have a cache or security plugin installed, but you still encounter an HTTP 502 error, it’s best to disable your plugins and re-enable them one by one. To do this, go to Plugins and simply click Disable in the Bulk Actions menu.
Then activate each plugin while updating your WordPress site after each one. Once the 502 error appears up again, you found the problem plugin. However, if you are unable to access your WordPress dashboard, try disabling them in your hosting dashboard or FTP program. Navigate to the wp-content directory and rename the plugins directory, eg plugins-disable. If you use Hostinger, go to your hPanel and click on Files. From there, go to File Manager -> public_html -> wp-content.
Once your site starts working after all plugins are disabled, you can rename the folder back to plugins. Then try activating the plugins one by one to determine which one caused the error in the first place. If the site still doesn’t work, follow the same steps with your WordPress themes.
Check Site Status
If the 502 error is still appearing up despite trying most methods so far, it is possible that the origin server is experiencing downtime. Fortunately, there are many tools on the web to examine if a site is down, including Down for Everyone or Just Me and IsItDown. Just enter your URL and check the status of your site.
Final note
I hope you like the guide How To Fix ‘502 Bad Gateway Error’ issue. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.