An HTTP 502 Bad Gateway is a response status code that indicates that the server cannot handle the request due to lack of bandwidth, capacity or otherwise. The most common cause for this error is an overload on the server side which has resulted in some errors being returned as 500s and others being returned as 502s. It can also be caused by external factors such as load balancing systems not functioning properly or links going down due to maintenance work.
HTTP 502 responses are typically accompanied by information about what caused the system failure so hopefully you'll never see one of these codes if your website's been working fine up until now!
Commonly, this is seen when the backend fails, for example a PHP overload or database failure.