Update patch to use passed HTTP_X_FORWARDED_PROTO as this is populated in some servers with http.