Set the r.URL.Scheme via middleware and log mismatches with the https flag in the context
The https
flag is now being passed around in the context to drive some logic. The idea is to use the r.URL.Scheme
instead.
This MR is a gradual change to start setting the value in r.URL.Scheme
using gorilla/handlers.ProxyHeaders
for proxy requests. The value is also being set for non-proxy requests.
The plan is to eventually remove the https
flag once we are confident that the https
flag in the context matches r.URL.Scheme
. We'll monitor by checking the logs expecting not to find any of these occurrences
.Error("request: r.URL.Scheme does not match value in ctxHTTPSKey")
Edited by Jaime Martinez