Merge pull request #134 from joyov/fix-reverse-proxy-scheme

Fix scheme detection when reverse proxy is used #130
This commit is contained in:
Leopere 2019-10-11 15:12:39 -04:00 committed by GitHub
commit 85a3e7928a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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"