Skip to content

Commit

Permalink
Revert "Fix remove original director"
Browse files Browse the repository at this point in the history
  • Loading branch information
bmf-san authored Jun 29, 2024
1 parent 1428b6e commit 03b6f25
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ func newServer(c *Config) (*http.Server, error) {
return nil, fmt.Errorf("error parsing upstream address: %w", err)
}

proxy := &httputil.ReverseProxy{
Transport: NewLogRoundTripper(http.DefaultTransport),
Director: func(r *http.Request) {
r.Header.Set("X-Trace-ID", GetTraceID(r.Context()))
r.URL = pp
},
proxy := httputil.NewSingleHostReverseProxy(pp)
proxy.Transport = NewLogRoundTripper(http.DefaultTransport)
originalDirector := proxy.Director
proxy.Director = func(r *http.Request) {
originalDirector(r)
r.Header.Set("X-Trace-ID", GetTraceID(r.Context()))
}
ph := &ProxyHandler{proxy: proxy}
mux.HandleFunc(b.HostName+"/", ph.Handler)
Expand Down

0 comments on commit 03b6f25

Please sign in to comment.