Update to handle HTTPS as well as HTTP