You can fix Error 502 by doing the following methods:
First, you need to close your current browser and hold up a couple of moments and reopen it. It is because Sometimes your browser may stop responding due to accessing the heavy traffic of data at the same time or maybe an error page is inserted in between the pages which are loading. Even you try on another browser as well.
You need to restart your internet modem. to do this, Unplug your internet modem and hold up for 5 seconds, after it completely turns off, Plugs it again and Wait for your computer to establish a connection again.
The Content Delivery Network or commonly known as CDN improves the loading speed of a website but it can generate error 502 as well due to the firewalls. To overcome this issue, you can disable the CDN temporarily.
The 502 (Bad Gateway) status code indicates that the server while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. The “proxy server” is a system or router that acts as a gateway between your computer and the internet.
How to fix?
Perform a hard-refresh in your browser. On Macs, this is done by pressing Cmd + Shift + R.
If you are surfing the Web and see this problem for all Web sites you try to visit, then either 1) your ISP has a major equipment failure/overload or 2) there is something wrong with your internal Internet connection e.g. your firewall is not functioning correctly. In the first case, only your ISP can help you. In the second case, you need to fix whatever it is that is preventing you reaching the Internet.
This problem is due to poor IP communication between back-end computers, possibly including the Web server at the site you are trying to visit. Before analysing this problem, you should clear your browser cache completely.
Finally, restart your computer/networking equipment. Some temporary issues with your computer and how it's connecting to your network could be causing 502 Bad gateway errors, especially if you're seeing the error on more than one website. In these cases, a restart would help.