Knowledge Base
MilesWeb / How-Tos

How To Fix the 502 Gateway Error? Know in Detail Here

Approx. read time : 6 min

Sometimes when you try to visit a website, your browser may get a 502 Bad Gateway Error. It is basically an HTTP error that tells the user that there is some problem in the requested web page. This is one of the most common errors on the internet, and there are different causes of this error.

In this guide will get to know some of the easy troubleshooting steps that can be followed to fix the 502 Bad Gateway error on the website.

What is the 502 Bad Gateway Error?

The 502 Bad Gateway error means when the server does not receive a valid response from an inbound server. To explain in simple words, whenever you visit any website, the web browser first sends a request to a web server.

The web server will then process the request and send back all the requested resources along with the HTTP header and HTTP status code. This error can occur anytime, and irrespective of what setup you’re using, like any browser, device or an operating system.

Browsers and servers both interact with each other using HTTP (HyperText Transfer Protocol). You don’t generally get to see the HTTP status codes unless something goes wrong. The server tells you that there is something not correct, along with the code.

There are five responses to the HTTP status code. Here we’ve mentioned them: 

  • 1xx – Informational (The request has been received, and its in process)
  • 2xx – success (The request was completed successfully and server gave the expected response)
  • 3xx – redirection (Getting redirected somewhere else)
  • 4xx – client error (The error seems to be have caused by the client)
  • 5xx – server error (Client must take actions to complete the request)
  • Related: What Are The Common HTTP Errors And How To Troubleshoot Them?

    Reasons For Getting a 502 Bad Gateway Error

    There are many reasons why you are getting a 502 error on your website when you’re trying to access it.

    DNS Changes

    During the migration of the server, domains sometimes require changes in the Domain Name System and the communication link between IP address and domain names. It can take hours to get activated completely.

    Origin Server Not Working Well

    Maybe the server is down or might be connectivity issues or you are getting too much traffic on your website. Due to this, the origin server might get overloaded and crash. A sudden increase in traffic, or low memory, are some of the reasons for server overload.

    Server Failure

    There are chances of server failure due to server maintenance

    Firewall Blocks

    A firewall keeps your website safe from any type of malicious traffic. However, some firewalls are oversensitive and they might detect false positives. The system might block a specific ISP or even a request from CDN.

    Browser Errors

    At times, a browser shows you a 502 error even if there are no network server issues. So, there are chances you may get this error due to the fault in the browser extensions like outdated browsers, ad-blockers, or if there are corrupted files in your browser’s cache.

    Ways to Fix the 502 Bad Gateway Error:

    A 502 bad gateway error is generally a problem with the server/network, however, sometimes, it also may be an issue from the client’s side.

    Here are some of the ways through which you can fix the 502 bad gateway error:

    1. Try To Reload the Page

    The first and foremost thing which is easy to do when you encounter the 502 bad gateway error is to wait for a minute and then reload the web page again. Try this shortcut. Press F5 or CTRL +F5, while if you’re a Mac user, you can go with CMD +R. Your site might come back by doing it. Even you can do one thing that is, try a different browser to fix this issue. To check if your website is offline or down with a too, there are different tools like

    2. Clearing Browsers Cache

    Whenever you face this type of error, you can even try to fix it by clearing the web browser’s cache. But also, you need to remember that removing all the cached files put you at risk of losing your browser data, it may help to resolve the problem.

    3. Change the DNS Server

    There are chances you get this error due to DNS problems. Changing the DNS server is also a step you can take to resolve this error. By default, your DNS servers are assigned by the ISP.

    4. Check Your Extensions and Plugins

    If are currently using extensions on your browser, these extensions may be causing the error. You can disable these extensions and then try accessing the website. If the error is disappeared and your website is live again, then this may be caused due to the plugin. You can also once browse your website in the in cognitive window. If you do not notice the error in this window, then this may be again caused due to the extensions and plugins installed on your website.

    5. Checking Site Status

    If you get the 502 error after trying all the methods, maybe the origin server is experiencing downtime. Also, there are many tools available that examine if the site is down or not like IsItDownDown for Everyone, Just Me. Just put the URL and check the current status of your website. 

    6. Check With Webhosting Provider

    We get to see 502 bad gateway errors because of the issues on the web hosts’ side. Sometimes, a script, query, or request takes very long and the server cancels it. Some web hosting provider implements, “the kill scripts,” which terminates a request after a certain amount of time so that it doesn’t affect other users or take the website down.

    7. Do Check for CDNs

    Another cause of the 502 bad gateway errors is the problem with your CDN or the DDos mitigation service. A content delivery network also helps to add a specific layer between your server and web browser to deliver the content efficiently.

    8. Reach Out to the Customer Support

    If you do not get a solution by trying all the above ways, it’s a good option to contact the support team. When you are explaining the issue, thoroughly include all the troubleshooting steps you have taken. And let the support team assist you.

    502 Bad Gateway Error Can Also Look Like:

    You can get 502 errors on almost any browser, service, or operating system. Here are the different variations of the 502 error that you may encounter.

    • Error 502
    • 502 Error
    • 502 service temporarily overloaded
    • HTTP 502
    • 502 bad gateway NGINX
    • 502 Proxy Error
    • Bad 502 Gateway
    • Chances of getting a blank screen

    Does 502 Bad Gateway Error Affect Websites SEO?

    If your site is down and not accessible due to a 502 Bad Gateway error, it affects your website’s traffic. Because any visitors browsing your website gets to see this error, may leave your website and never visit again. However, the longer your site is unavailable, the higher the bounce rate will be. This error may also affects the indexing of your website. There are chances of your website ranking going down and having an impact on the organic traffic.


    A 502 Bad Gateway error does not come due to an internet connection, or from your website, it generally happens when a server functioning as a gateway gets an invalid response from origin server. If you do not fix the error at the start itself, it may affect your page rankings, SEO, and ultimately conversions. 502 Bad Gateway is common website error, and so you should not get frustrated.

    We hope the above troubleshooting steps have helped you to fix the errors you might face on your website.

    Nehal Khatri
    Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.