Fix scheme detection when reverse proxy is used

This commit is contained in:
joyov 2019-10-11 20:01:18 +02:00
parent d4f383a005
commit 2c9675b48b

View file

@ -222,7 +222,7 @@ func BaseURLMiddleware(next http.Handler) http.Handler {
ctx := r.Context()
var scheme string
if strings.Compare("https", r.URL.Scheme) == 0 || r.Proto == "HTTP/2.0" {
if strings.Compare("https", r.URL.Scheme) == 0 || r.Proto == "HTTP/2.0" || r.Header.Get("X-Forwarded-Proto") == "https" {
scheme = "https"
} else {
scheme = "http"