0 items
24/7 Support & Sales   1300 210 210
Online Support Domain Names

502 Bad Gateway error explained

502 Bad Gateway is an HTTP (Hyper Text Transfer Protocol) status code. It basically means that one server has received an invalid response from another. Often, the problem is because the protocols of two servers, usually an upstream server and a gateway server, for exchanging data are in 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.
Fun fact: Among HTTP status codes, all 5xx error messages generally mean that the server being accessed failed to accomplish or fulfil a valid request.

What are the 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:

  1. The upstream server, or the server that is higher in the hierarchy or servers, is down and cannot be accessed.
  2. The origin server, or the highest server in the hierarchy of servers, is down or cannot be reached.
  3. Multiple users are accessing the site at the same time, and the server has become overloaded.
  4. There are bugs in the site’s associated PHP programming, which is making the site unstable.
  5. There are some issues with your internet browser and it cannot find and access the site or web page.
  6. Your internet gateway or router is unable to communicate or pull content from the origin server, probably because of a firewall.
Important Note: 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:

  1. Check if the site is really down. Confirm that the site is really 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 really 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.


  2. If the site is not really down and it’s only you who can’t access it, you should try the troubleshooting methods below:


  3. 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.

  4. 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.

  5. 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.

  6. Open new browser sessions. Close all your browser windows and tabs and open new ones. It is likely that the 502 error 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.

  7. 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 Chrome, Firefox, Internet Explorer, Opera, and Safari.

  8. 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.

  9. 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.

  10. 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.


  11. If you are the webmaster or you own the website that is returning the 502 error, you can try the following solutions:


  12. 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 really using to free space in your server.

  13. 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.

  14. Optimise your scripts. Try compressing your CSS and Javascript files. This is to minimise lag times, especially for heavy sites. When a site is too heavy, it sometimes takes too long for it to respond to queries and this sometimes causes 502 errors.

If you want to know about HTTP 404 Not Found error, click here.

If you want to know how to create custom Error pages, click here.
Was this helpful? Yes No 89% of people found this helpful.