The first and easiest thing you can do is simply reload the page. A 502 error code and a 504 error code are both server-side errors. This means that there is something wrong with the server. The problem could be anything from the server being down to the server being too busy.