Sometimes, when an HTTP server (e.g. Apache, IIS) returns a response code 502, it means that you used http://example.com and you should have used httpS://example.com.