Error 502 Bad Gateway means that the origin server sent an invalid response to another server that took a while to respond and could not resolve the response.
How to Fix Error 502 Bad Gateway
The first solution is quite simple. Wait about a minute or two and reload the page you are trying to access. In many cases the error is temporary and a simple reload of the page will resolve it.
If the error persists, there is a possibility that some cached element is causing the problem. Therefore, clearing the browser’s cache is one approach you can use to try to fix the error.
Checking the connection using a different browser or in anonymous mode is also a great idea. This will allow you to rule out the option that the error appeared because of a browser-related problem.