diff --git a/main.go b/main.go index 8766c86d..dd6fdd70 100644 --- a/main.go +++ b/main.go @@ -251,13 +251,16 @@ func computeRoutePrefix(prefix string, externalURL *url.URL) string { } if prefix == "/" { - prefix = "" + return "" } - if prefix != "" { - prefix = "/" + strings.Trim(prefix, "/") + // Ensure prefix starts with "/". + if !strings.HasPrefix(prefix, "/") { + prefix = "/" + prefix } + prefix = strings.TrimSuffix(prefix, "/") + return prefix }