From 94d7f12667d6bcee646347151b0deba28960b71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gra=C3=B1a?= Date: Wed, 15 Oct 2014 09:51:05 -0200 Subject: [PATCH] Detect https scheme when serving ssl --- shared/httputil/httputil.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/httputil/httputil.go b/shared/httputil/httputil.go index a71dc73d9..4affaccec 100644 --- a/shared/httputil/httputil.go +++ b/shared/httputil/httputil.go @@ -13,6 +13,8 @@ func IsHttps(r *http.Request) bool { switch { case r.URL.Scheme == "https": return true + case r.TLS != nil: + return true case strings.HasPrefix(r.Proto, "HTTPS"): return true case r.Header.Get("X-Forwarded-Proto") == "https": @@ -30,6 +32,8 @@ func GetScheme(r *http.Request) string { switch { case r.URL.Scheme == "https": return "https" + case r.TLS != nil: + return "https" case strings.HasPrefix(r.Proto, "HTTPS"): return "https" case r.Header.Get("X-Forwarded-Proto") == "https":