The first thing we recommend you do is update your browser, it is also good to close the launcher and after a few minutes open it again. We also recommend turning off your internet modem or router for a few minutes to turn it back on later.
Faced with these types of errors, the best you can do is wait for the flow of users to drop and the servers to stabilize again. Although you can also contact the game support if you have been with this problem for many days.
For now that's all there is to how to fix the 502 Bad Gateway error in Genshin Impact, so we hope you can fix this problem while the developers take care of it.