Skip to content

Commit

Permalink
Merge pull request #54 from bmf-san/fix/remove-unnecessary-director
Browse files Browse the repository at this point in the history
Fix remove original director
  • Loading branch information
bmf-san authored Jun 29, 2024
2 parents 8f75c5d + 04eaf6d commit 1428b6e
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.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()))
proxy := &httputil.ReverseProxy{
Transport: NewLogRoundTripper(http.DefaultTransport),
Director: func(r *http.Request) {
r.Header.Set("X-Trace-ID", GetTraceID(r.Context()))
r.URL = pp
},
}
ph := &ProxyHandler{proxy: proxy}
mux.HandleFunc(b.HostName+"/", ph.Handler)
Expand Down

0 comments on commit 1428b6e

Please sign in to comment.