Error 502 Bad Gateway: How to fix?

0
63

When we visit a website, the browser sends a lot of requests to the web server. A 502 Bad Gateway error is an HTTP status code, which means that a server receives an “invalid” response from another server.

502 bad gatewway nginx error fix

Similar to 500 internal server error or 503 service unavaiable error, this error makes you extremely headache, I have experienced it. So, I am writing this article so that we can focus on the reason and how to solve the 502 bad gateway error.

2. Signs and causes

Sign

A 502 bad gateway means the original server sends an invalid response to another middle server such as a gateway and proxy. Since all web requests are routed through multiple gateways, it can be very difficult to know exactly where the error is or what process causes the error. However, there are several ways you can refer to fixes:

502 Bad gateway error on each site will be different. However, if you encounter a Bad Gateway error, you will see one of the following error messages:

    • “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”

  • “Fail Whale” is one of Twitter’s notorious “bugs”, and the nature of the error is the 502 Bad Gateway.
  • Bad Gateway error in Windows Update typically generates error code 0x80244021 or WU_E_PT_HTTP_STATUS_BAD_GATEWAY error message.

Causes

Typically, Bad Gateway errors occur because of problems between servers online that you can not “control”. However, still have some reason by users.

How to fix 502 Bad Gateway Error

As mentioned above, the cause of 502 Bad Gateway error is due to server error is congested network or due to some problem that you can not control.

To fix this you can refer to some of the solutions below:

1. Reload the website

Try reloading the URL code again by pressing the F5 key, or by clicking the Refresh / Reload button.

The 502 Bad Gateway error has occurred because the server is temporarily down for upgrade, it is only a temporary error, so you can apply the page reload solution again to fix the error. Also, you can check is website down here.

2. Delete Browser Cache and cookies

Outdated files or corrupted files stored in your browser may be the cause of the 502 error. In this case, just delete the cache files and try reopening the page you want. Access is complete.

Refer to the steps for clearing your browser cache and cookies here.

3. Use a different browser

Change other web browsers or in incognito mode. It will show you whether the error is on the browser side or not.

4. Flush DNS

The 502 bad gateway error can also be caused by a DNS-related problem, such as an incorrectly cached IP address. So to fix the flush you DNS. Here is a tutorial on how to flush DNS on Windows, Mac, and Linux.

You can also try using DNS instead of the default DNS like using Cloufare Public DNS.

5. Start the browser in Safe Mode

When your browser runs in Safe Mode, it means that the browser will run the same default settings, without add-ons, extensions and toolbars.

While running the browser in Safe Mode, if no error 502 then you can confirm that the cause of the error 502 is due to the extension or browser settings. You just need to reset your browser settings to default or disable the extensions that caused the error.

Note: To run the browser in Safe Mode, simply boot your Windows machine in Safe Mode and run any browser you use.

6. Try on another device

If none of the above methods helps you to remove the 502 bad gateway that appears on the screen, try testing it on another computer or phone, preferably using another network such as 3G/4G. This is the last step to test whether the error is due to your computer or not.

7. Use Software Update 1 for Microsoft Forefront Threat Management Gateway (TMG) 2010 Service Pack 1

If you have installed MS Forefront TMG SP1 and during the process of accessing a website you receive an Error Code: 502 Proxy Error. Lỗi mạng mạng. (1790) or other similar error messages.

You can then download and install Software Update 1 for Microsoft Forefront Threat Management Gateway (TMG) 2010 Service Pack 1 to fix the problem.

Download Software Update 1 for Microsoft Forefront Threat Management Gateway (TMG) 2010 Service Pack 1 and install it here.

Note:

This solution is not a general solution to fix 502 Proxy Error error that only applies in some specific cases.

Restart your computer

Some temporary crashes in your computer connected to the Internet may cause a 502 error. This is very simple, just restart your computer to fix the error. .

9. Restart the network equipment

In some cases, problems on modems, routers, switches, or other network devices may also cause a 502 error or a 502 Bad Gateway error. In this case you just need to reboot the device: modem, router, switches … is done again.

10. Change the DNS

Change DNS on Servers (servers), or your router, computers, or devices. Sometimes Bad Gateway errors are caused by temporary problems on DNS Servers.

11. Contact the site directly

This is also one of the best solutions to fix the 502 Bad Gateway. It is possible that in many cases the site is faulty and the site administrator has not fixed the error, and this is the cause of the 502 Bad Gateway error.

You can visit the Website Contact Information page to view contact lists for some popular websites today. Most websites have social networking accounts used to support their services, some of which include email and phone numbers for users to contact.

12. Contact your Internet Service Provider

The final solution to the 502 Bad Gateway error is to contact your Internet Service Provider to find out the cause and fix the problem.

Epilogue

In this tutorial, we learned about the 502 bad gateway error and how to fix it in simple yet effective ways.

If you have any other tips, or solutions to this problem, please share with everyone by leaving comments below.