When you see the 502 Bad Gateway error while using a custom host, then there can be multiple reasons. Some of them are noted below:
Make sure all of your web services are working correctly.