diff --git a/proxy/balancing.go b/proxy/balancing.go index 90d638506..a6ab246e7 100644 --- a/proxy/balancing.go +++ b/proxy/balancing.go @@ -5,7 +5,6 @@ package proxy import ( "context" "net/url" - "strings" "github.com/luraproject/lura/v2/config" "github.com/luraproject/lura/v2/logging" @@ -97,10 +96,7 @@ func newLoadBalancedMiddleware(l logging.Logger, lb sd.Balancer) Middleware { } r := request.Clone() - var b strings.Builder - b.WriteString(host) - b.WriteString(r.Path) - r.URL, err = url.Parse(b.String()) + r.URL, err = url.Parse(host + r.Path) if err != nil { return nil, err } diff --git a/proxy/http.go b/proxy/http.go index 2f9e1908c..726c54821 100644 --- a/proxy/http.go +++ b/proxy/http.go @@ -114,11 +114,10 @@ func newRequestBuilderMiddleware(l logging.Logger, remote *config.Backend) Middl l.Fatal("too many proxies for this %s %s -> %s proxy middleware: newRequestBuilderMiddleware only accepts 1 proxy, got %d", remote.ParentEndpointMethod, remote.ParentEndpoint, remote.URLPattern, len(next)) return nil } - return func(ctx context.Context, request *Request) (*Response, error) { - r := request.Clone() + return func(ctx context.Context, r *Request) (*Response, error) { r.GeneratePath(remote.URLPattern) r.Method = remote.Method - return next[0](ctx, &r) + return next[0](ctx, r) } } }