From c526fa91197f5c3e3d1140f2550b203c10c60aad Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Sun, 17 Apr 2022 16:01:49 -0700 Subject: [PATCH] Support console UI access at a subpath on a subdomain (#14761) fixes #14285 Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- cmd/common-main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/common-main.go b/cmd/common-main.go index ea9fda5b4..dc59f3e4b 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -177,6 +177,10 @@ func minioConfigToConsoleFeatures() { os.Setenv("CONSOLE_LOG_QUERY_AUTH_TOKEN", value) } } + // pass the console subpath configuration + if value := env.Get(config.EnvMinIOBrowserRedirectURL, ""); value != "" { + os.Setenv("CONSOLE_SUBPATH", pathJoin(globalBrowserRedirectURL.Path, SlashSeparator)) + } // Enable if prometheus URL is set. if value := env.Get("MINIO_PROMETHEUS_URL", ""); value != "" { os.Setenv("CONSOLE_PROMETHEUS_URL", value) @@ -637,12 +641,11 @@ func handleCommonEnvVars() { } // Look for if URL has invalid values and return error. if !((u.Scheme == "http" || u.Scheme == "https") && - (u.Path == "/" || u.Path == "") && u.Opaque == "" && + u.Opaque == "" && !u.ForceQuery && u.RawQuery == "" && u.Fragment == "") { err := fmt.Errorf("URL contains unexpected resources, expected URL to be of http(s)://minio.example.com format: %v", u) logger.Fatal(err, "Invalid MINIO_BROWSER_REDIRECT_URL value is environment variable") } - u.Path = "" // remove any path component such as `/` globalBrowserRedirectURL = u } }