The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
What causes a 502 error?
A 502 bad gateway message indicates that one server got an invalid response from another. In essence, you've connected with some kind of interim device (like an edge server) that should fetch all of the bits you need to load the page. Something about that process went wrong, and the message indicates the problem.