502 Bad Gateway is an HTTP (HyperText Transfer Protocol) status code. It means that one server has received an invalid response from another. Often, the problem is because of the protocols of two servers, usually an upstream server and a gateway server, for exchanging data conflict with each other.
According to the W3C (World Wide Consortium), the error is defined as the following:
“The server, while acting as a gateway or proxy, received an invalid response from the upstream server
it accessed in attempting to fulfil the request.”
When you get a 502 Bad Gateway status code, the default error message is displayed on a blank white web page with simple black font text.
Much like the 404 Not Found error, the 502 Bad Gateway error can also be customised. More often than not, however, it will be displayed in any of the following ways:
- Error 502
- HTTP 502
- 502 Proxy Error
- 502 Bad Gateway
- 502. That's an error.
- Temporary Error (502)
- Bad Gateway! Error 502
- HTTP Error 502 - Bad Gateway
- 502 Service Temporarily Overloaded
- 502 Server Error: The server encountered a temporary error and could not complete your request.
- Bad Gateway: The proxy server received an invalid response from an upstream server.
Possible Causes of HTTP 502 Bad Gateway Errors
Often, the cause of this HTTP error is not localised, which means it has nothing to do with your computer but more to do with the hosting server of the website you are trying to access. In the interest of being thorough, however, here are the following possible causes of a 502 Bad Gateway error code:
- The upstream server, or the server that is higher in the hierarchy of servers, is down and cannot be accessed.
- The origin server, or the highest server in the hierarchy of servers, is down or cannot be reached.
- Multiple users are accessing the site at the same time, and the server has become overloaded.
- There are bugs in the site’s associated PHP programming, which is making the site unstable.
- There are some issues with your internet browser and it cannot find and access the site or web page.
- Your internet gateway or router is unable to communicate or pull content from the origin server, probably because of a firewall.
Servers running Microsoft IIS (Internet Information Services)
return more specific 502 Bad Gateway
messages according to their causes. They are the following:
- 502.1 - CGI application timeout.
- 502.2 - Bad gateway: Premature Exit.
- 502.3 - Bad Gateway: Forwarder Connection Error (ARR).
- 502.4 - Bad Gateway: No Server (ARR).
If you get a 502.1 error, it is better resolved by treating it as a 504 Gateway Timeout error and troubleshooting it accordingly.
Easy Ways to Troubleshoot an HTTP 502 Bad Gateway Error
Although an HTTP 502 Bad Gateway error is often an issue outside of your computer, there is still a possibility that you may be able to find a solution to the issue.
Here are some ways you may be able to remedy a 502 error:
- Check if the site is down. Confirm that the site is down or it’s just you who can’t access it. Use web tools that would help you check this such as
isitdownorjust.me, or isup.me.
If the site is down, contact the webmaster and inform them about the issue. Chances are they are already trying to fix it, or if they are not yet, they will certainly be grateful for the heads up.
If the site is not down and it’s only you who can’t access it, you should try the troubleshooting methods below:
- Clear your browser cache. It could just be a cache-related issue. Perhaps your browser unknowingly stored corrupted files stored a copy of the error, or just has too many cached versions of the site and so your browser got confused.
- Refresh the page. Press F5 to reload the page or Ctrl + F5 for a hard refresh. Often, a 502 Bad Gateway error is temporary and simply reloading the page could resolve the issue.
If you are on a Mac computer, click Command key + R to refresh a web page.
- Delete your cookies. Your browser could be overloaded with too many cookies, or perhaps it has stored corrupted cookies. To resolve this, you let your browser start fresh and store new cookies.
If you’re concerned that you may be unable to retrieve important passwords, try deleting the cookies related to the site you’re trying to access first. If that doesn't work, delete the rest of the cookies.
- Open new browser sessions. Close all your browser windows and tabs and open new ones. The 502 error has likely has passed but your browser just could not update the status, even though the issue has been resolved in the origin server. A simple browser restart could resolve the issue.
- Use another web browser. Perhaps the 502 error is an issue specific to a browser. If this is the case, using another web browser could solve the problem. Popular web browsers you can try are
- Restart your computer. Perhaps there are some temporary issues with your computer and it is unable to correctly connect to your network. If this is the case, a basic reboot of your machine might solve the issue. This is especially applicable if all the websites or web pages you visit are returning 502 errors.
- Restart your modem or router. It could be that your networking device is the one causing the 502 error. It might be lagging or is just temporarily unstable. A simple reboot of these devices could help resolve the issue.
- Contact your ISP (Internet Service Provider). If you get the 502 error message on all the sites you visit, then it is quite probable that your ISP (Internet Service Provider) has failed or is overloaded. If this is the case, contact your Internet provider.
If you are the webmaster or you own the website that is returning the 502 error, you can try the following solutions:
- Disable unnecessary plugins. If you’re using a CMS such as WordPress, it might be a good idea to reassess the plugins you have installed in your site and do some “spring cleaning” of some sort. Uninstall and delete the ones you’re not using to free space in your server.
- Check your PHP settings. Adjust the memory limit and maximum execution time in your site. This way, it will help minimise overloading, and in turn, downtimes in your server.
You can also view our other guides for 500 Internal Server error and 503 Service Unavailable error.If you need any further assistance, or if you have any questions, please let us know. We’d love to help!
Fantastic...Thank you for your feedback =)
Sorry... Please submit a support ticket or try another search.