18 March, 2023

What is a 502 Bad Gateway error? Causes and how to fix it

Are you running into a 502 Bad Gateway error and don't know how to fix it? Then this article is for you. MONA Media will walk you through everything about what the 502 Bad Gateway error is, how to spot it, and the most effective ways to fix it.

502 Bad Gateway error explained

The 502 Bad Gateway error is an HTTP status code. While using the internet, you will sometimes see this error if you proxy or gateway get an invalid response (not valid) from the origin server. You then cannot access the site's content or information.

What is a 502 error?

Every time you visit a website, your browser sends a request to the web server (web server). The web server then receives and processes the request, and sends back the requested resource along with HTTP headers and an HTTP status code.

Normally you don't see the HTTP status code unless something goes wrong. It is how the server tells you there is a problem, along with a specific error code.

A 502 Bad Gateway error means a server, while acting as a proxy or gateway, received an invalid response from the inbound server.

How does the 502 Bad Gateway error affect SEO?

Unlike the 503 error, which is used for maintenance mode WordPress and asks Google to check back later, a 502 error can hurt SEO if it is not fixed as soon as possible.

Specifically, if a site stays down for a long time with a 502 error, for example more than 6 hours, Google may treat it as a site-level problem that needs fixing. That hurts the site's ranking. So if you're worried that a 502 error will happen again, look into why it appears.

Signs of a 502 Bad Gateway error

How to recognize a 502 Bad Gateway error

A 502 Bad Gateway error looks different on each site. You may see messages like these when you hit a 502:

  • “502 Bad Gateway”
  • “502 Service Temporarily Overloaded”
  • “Error 502”
  • “Temporary Error (502)”
  • “502 Proxy Error”
  • “502 Server Error: The server encountered a temporary error and could not complete your request.”
  • “HTTP 502”
  • “502. That’s an error.”
  • “Bad Gateway: The proxy server received an invalid response from an upstream server.”
  • “HTTP Error 502 – Bad Gateway”

A 502 error usually shows in the browser window as well as on the web page. On Twitter, a 502 Bad Gateway error is usually reported as “Fail Whale”.

In addition, a Bad Gateway error in Windows Update produces error code 0x80244021 or the error message WU_E_PT_HTTP_STATUS_BAD_GATEWAY.

In Google services, for example Google Search or Gmail, a 502 error is usually shown as a server error (Server Error), or in some cases simply as 502 on the screen.

Causes of the 502 Bad Gateway error

Causes of the 502 error code

On the causes of the 502 error code, MONA has put together the common ones below:

  • A conflict between the online server and your computer.
  • A problem with your browser.
  • The server is misconfigured or overloaded by a large amount of traffic coming in.
  • There is a problem with DNS, plugins or the browser cache.

Quick fixes for the 502 Bad Gateway error

To fix the 502 Bad Gateway error smoothly and quickly, try the solutions below:

Reload the page to fix a 502 Bad Gateway error

For this fix, try loading the page again by pressing F5 or clicking Refresh/Reload. If the HTTP 502 error doesn't come back, the failure was only temporary and has little impact.

Restart your web browser

Restart the browser to fix a 502 bad gateway error

Close all your browser windows, then reopen the browser and try the website again. In this case, the 502 error may come from a problem on your device while browsing.

Try a different browser

Sometimes the 502 error appears because of a glitch in the connection between the server and your devices. In that case, consider switching to another browser such as: Chrome, Cốc Cốc, Firefox, Edge, Safari,… You can also uninstall your current browser and reinstall it to make it run more reliably.

Check and reset your network devices

From experience, MONA has seen that problems with a modem, router, switches or other network devices can also cause a 502 error code. In that case, just restart these devices: modem, router, switches,… and the problem should be fixed.

Clear the browser cache

Fix a 502 error by clearing the cache

Outdated or corrupted files stored in your browser can also cause a 502 Bad Gateway error. In that case, just clear the cache files and try opening the page again.

-> See How to clear the cache in every browser

Clear your browser cookies

If you've cleared the browser cache and the 502 error is still there, MONA suggests you consider deleting the cookies from your web browser to fix the error.

Note: If you don't want to delete all browser cookies, you can find and delete only the cookies related to the website that shows the 502 error.

Change your DNS

Change your DNS

If you are a web developer, changing Web Hosting or switching to a new an IP address will stop users from reaching the website's data immediately. Check where the changeover stands; it usually takes a few hours to complete.

If you are a visitor, you can switch to a different DNS, such as Google Public DNS, instead of the default one to reach the page.

Flush DNS

Besides changing DNS, consider flushing your DNS. In many cases, a wrong or outdated cached DNS can also cause a 502 Bad Gateway error. Follow these steps with MONA:

For Windows

  • Step 1: Press the keys Windows + R to open Windows command prommand -> Search for cmd -> Select OK.
Flush DNS on Windows
  • Step 2: Type the command “ipconfig /flushdns” as shown below -> Select Enter to finish.
Steps to flush DNS on Windows

On macOS

  • Step 1: Click Command + Space to open Terminal -> Search for “Terminal” in Spotlight -> Double-click the first result.
Flushing DNS on macOS
  • Step 2: Enter the command “sudo dscacheutil –flushcache” to finish.
Steps to flush DNS on macOS

Check your plugins again

Checking plugins to fix the 502 error

One way to fix a 502 Bad Gateway error is to check your plugins and extensions again. A caching plugin may be what is causing the 502 error.

Disable all plugins for a short time to confirm. To do this, go to the wp-content folder and rename the plugins folder.

If the website works again once every plugin is disabled, one of the plugins is causing the error. Rename the folder back to plugins, then disable the plugins one at a time to find exactly which one is at fault.

Start your browser in Safe Mode

From years of experience handling technical problems on client websites, MONA knows that a browser running in Safe Mode usually uses default settings, with no add-ons, extensions or toolbars.

Turning on Safe Mode to fix the 502 Bad Gateway error

So if the 502 error does not appear while the browser is in Safe Mode, you can be sure it comes from an extension or a browser setting. Just reset the browser settings to default, or try disabling the extensions that cause the error.

Note: To start the browser in Safe Mode, boot Windows in Safe Mode and open the browser as usual.

Contact the website

It may be that the site has a fault its admins have not yet “fix”, and that is what causes the 502 Bad Gateway error.

If so, you can visit the Website Contact Information page to see the contact list. Most websites have accounts social media set up to support their services, and some also list an email address and phone number so users can get in touch more easily.

Contact your Internet service provider

This is the last way to fix the 502 Bad Gateway error. Contact your Internet service provider (Internet Service Provider) so they can help you find the cause and fix it as quickly as possible.

Above is the detailed information on the 502 Bad Gateway error along with its causes, signs and effective fixes. We hope the information MONA Media shared above helps you understand the 502 error code better and pick the fix that suits you best. Good luck!

Learn more about other errors and how to fix them:

MONA has a podcast: listen instead of readingEpisodes on AI, automation & SEO for Vietnamese businesses
Nghe ngay
About the author

CEO & Founder · The MONA

Founder of The MONA, who built a services company of 200+ staff with 14,000+ projects delivered. Khánh Hùng shares how he thinks about building systems that run themselves, automating a business, and the real lessons from delivering projects at MONA.

Views 1,5K
Rate this article 4,8/5 · 12 ratings

Related articles

Professional website
design services

Own a website with a beautiful, 100% exclusive design and a lifetime warranty, with the ability
to expand features flexibly as your business grows, starting today!

Contact Mona

    MONA có riêng một Người "Bạn Thân" cho bạn - Người Account sẽ đồng hành, hỗ trợ, hướng dẫn, đặt đồ ăn cho bạn mãi mãi, từ đây về sau!
    MONA will never sell your information or send you spam
    Đội MONA tư vấn hệ thống quản lý giáo dục trực tuyến
    Hỏi đáp giáo dục 4.0
    Tạo cuộc hẹn miễn phí với MONA để giải đáp và tư vấn mọi thắc mắc về giải pháp số hoá ngành giáo dục
    Thời lượng cuộc hẹn
    45 Phút
    Ngày và giờ
    Thứ 2, ngày 25 tháng 12, 2023
    [9:30 - 10:15]

      Chọn ngày và giờ
      Khung giờ
      Back
      Hãy cho MONA biết bạn là ai
      0:00