From e85c07b9071a23457bef9e336ecd3d9cf5ac27a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zo=C3=AB=20Ma?= Date: Tue, 23 Jul 2024 18:34:04 +0800 Subject: [PATCH] 21998: Try to find original request's scheme in URL generated for wget. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In the "wget" example generated on the directory listing page, try to make the scheme part in the URL argument closer to the original request's, by using the value of "X-Forwarded-Proto" header if it's valid. Arvados-DCO-1.1-Signed-off-by: Zoë Ma --- services/keep-web/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go index 1e0e1852b3..c9381bd679 100644 --- a/services/keep-web/handler.go +++ b/services/keep-web/handler.go @@ -756,8 +756,8 @@ func relativeHref(path string) string { // form. func makeQuotedUrlForWget(r *http.Request) string { - var scheme string - if r.TLS != nil { + scheme := r.Header.Get("X-Forwarded-Proto") + if scheme == "https" || r.TLS != nil { scheme = "https" } else { scheme = "http" -- 2.30.2