Use ssl if endpoint is HTTPS