diff --git a/proxy/proxy.go b/proxy/proxy.go index 7bed09b2..ff66cd88 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -80,14 +80,16 @@ func (p *Proxy) ProxyHTTP( } p.logRequest(req, logFields) - fmt.Println(fmt.Sprintf("before: req.URL.Path: %s", req.URL.Path)) - parts := strings.Split(req.URL.Path, "/") - fmt.Println("parts:", parts) - if len(parts) > 1 { - parts[1] = rule.Location + if rule.Location != "" { + fmt.Println(fmt.Sprintf("before: req.URL.Path: %s", req.URL.Path)) + parts := strings.Split(req.URL.Path, "/") + fmt.Println("parts:", parts) + if len(parts) > 1 { + parts[1] = rule.Location + } + req.URL.Path = path.Clean(strings.Join(parts, "/")) + fmt.Println(fmt.Sprintf("after: req.URL.Path: %s", req.URL.Path)) } - req.URL.Path = path.Clean(strings.Join(parts, "/")) - fmt.Println(fmt.Sprintf("after: req.URL.Path: %s", req.URL.Path)) switch originProxy := rule.Service.(type) { case ingress.HTTPOriginProxy: