From 60fa30a605357ce9b398a882208ba1350a2f8cfd Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 22 Jan 2018 19:06:34 -0700 Subject: [PATCH] Fix scheme detection in URL --- urlbuilder/url.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/urlbuilder/url.go b/urlbuilder/url.go index 3c015eeb..1f8e8d35 100644 --- a/urlbuilder/url.go +++ b/urlbuilder/url.go @@ -192,7 +192,11 @@ func parseRequestURL(r *http.Request) string { } // Use incoming url - return fmt.Sprintf("http://%s%s", r.Host, r.URL.Path) + scheme := "http" + if r.TLS != nil { + scheme = "https" + } + return fmt.Sprintf("%s://%s%s", scheme, r.Host, r.URL.Path) } func getURLFromStandardHeaders(r *http.Request) string {