When browsing the internet, there are a number of different error messages that you can encounter. When this happens, your browser will let you know what the problem is by displaying a code that relates to the problem.
These codes all correspond to particular issues with the connection between the browser and the website that it is attempting to access.
Reference: https://www.itpro.co.uk/web-hosting/30258/what-is-a-502-bad-gateway-and-how-do-you-fix-it