diff --git a/internal/proxy/director/director.go b/internal/proxy/director/director.go index 7ebba03..c2480ec 100644 --- a/internal/proxy/director/director.go +++ b/internal/proxy/director/director.go @@ -41,21 +41,11 @@ func (d *Director) rewriteRequest(r *http.Request) (*http.Request, error) { for _, p := range proxies { for _, from := range p.From { - logger.Debug( - ctx, "matching request with proxy's from", - logger.F("from", from), - ) - if matches := wildcard.Match(url.String(), from); !matches { continue } - logger.Debug( - ctx, "proxy's from matched", - logger.F("from", from), - ) - - ctx = logger.With(ctx, + proxyCtx := logger.With(ctx, logger.F("proxy", p.Name), logger.F("host", r.Host), logger.F("remoteAddr", r.RemoteAddr), @@ -63,7 +53,7 @@ func (d *Director) rewriteRequest(r *http.Request) (*http.Request, error) { metricProxyRequestsTotal.With(prometheus.Labels{metricLabelProxy: string(p.Name)}).Add(1) - proxyLayers, err := d.getLayers(ctx, p.Name) + proxyLayers, err := d.getLayers(proxyCtx, p.Name) if err != nil { return r, errors.WithStack(err) } @@ -83,8 +73,8 @@ func (d *Director) rewriteRequest(r *http.Request) (*http.Request, error) { r.URL.Scheme = toURL.Scheme r.URL.Path = toURL.JoinPath(r.URL.Path).Path - ctx = withLayers(ctx, layers) - r = r.WithContext(ctx) + proxyCtx = withLayers(proxyCtx, layers) + r = r.WithContext(proxyCtx) return r, nil }