We are sorry for the inconvenience if you encounter such an error working with your site. It happens when a server functioning as a gateway or proxy receives an invalid response from the origin server. Basically, it is your server-related issue.

There might be a lot of reasons why the 502 error occurs: there might start with your browser settings and end up with an incorrectly working CDN service (for instance, Cloudflare). We have collected the most valuable tips on troubleshooting the issue from your end. Follow the steps below.

Causes of 502 Bad Gateway

We want to mention the most prevalent causes of the error so that you can have some basic comprehension of the issue. If you are familiar with server’s administration, it might be helpful for you to examine potential reasons, such as:

  • Unresolved domain name: If you have recently migrated your domain name to another host, this will be the most likely cause of the error. Please remember that the changes might take up to 24 hours to be fully active.

  • Origin server overload: It usually occurs when the origin server runs out of resources: a sudden increase of the site’s traffic, low memory, and software timeouts.

  • Browser errors: sometimes, your browser returns the 502 error despite your server working correctly. It is usually triggered by some browser extensions (commonly ad-blockers), outdated browser versions, corrupted files in your browser cache, and can only be fixed from your end (we will show you how soon).

  • Network connection problems: If you encounter the error in many different sites or browsers, it indicates that there might be some temporary issues with your internet connection.

  • Firewall: If you use a firewall on your site, there is a good chance it is too sensitive and might detect some false positives.

How to fix it

As we mentioned before, this error is usually server-related. However, it’s always a good idea to try troubleshooting the issue on your own because there is no risk to make it worse. We’d recommend following the steps one by one until it’s resolved.

Refresh the Page

As simple as it sounds, but still effective. Please hold on for a minute and refresh the page. If everything gets back to life, the issue has probably been caused by a sudden soar in the site traffic.

Clear Browser Cache

If the issue persists, there can be some corrupted files in your browser cache, so clearing the cache can potentially fix the Bad Gateway error.

Check in Incognito Mode

Another simple solution is checking your site in incognito mode. It allows you to determine whether the 502 error is a browser-related problem in this particular case. You can switch to the incognito mode by clicking the three dots in Google Chrome and clicking ‘New Incognito Window’:

or by using the following shortcut SHIFT+CNRL+N (SHIFT+CMD+N).

Test on Another Device

If nothing of the above helped you solve the issue, if possible, please check your site on another device, preferably with another network connection. Restarting your computer and network appliances can also help in some cases. This one lets us understand whether the issue is related to your network connection.

Check Plugins and Themes

Some of the plugins you use can cause your site to return 502 Bad Gateway. Usually, these are security and caching plugins. Sometimes, they disrupt the communication between your site and the server. It might help if you disable all the plugins on your site and then activate them back one by one. Go to Plugins and simply click Deactivate from the Bulk Actions menu.

Refresh the page after each plugin activation. Once the error appears, you have found the faulty plugin.

Check CDNs (CloudFlare)

Another possible error cause can be problems with your CDN or DDoS services. Since the services add an extra layer between your server and browser, it can run into an issue when connecting to the origin server. As a result, you see 502 Bad Gateway.

If you use Cloudflare and face such an issue, we recommend checking their detailed guide on troubleshooting the problem. If nothing helps, please reach out to their support.

Check the Site Status

Does the issue persist? The server may be currently experiencing downtime. Fortunately, many services allow you to check whether you are the only one experiencing the problem. For example, this one. Simply input your site’s URL to check its status. If it’s down for everyone and not just you, then you might want to check it once again in a while. If nothing changes, please go ahead and proceed to the next step.

Contact Customer Support

If none of the above solutions helped, please contact your hosting customer support team. Please mention the steps you did to troubleshoot the issue while describing the problem to your support assistant.

If you use the Alidropship Hosting, feel free to contact us here.

Did this answer your question?