Skip to content

Commit

Permalink
Merge pull request #55 from bmf-san/revert-54-fix/remove-unnecessary-…
Browse files Browse the repository at this point in the history
…director

Revert "Fix remove original director"
  • Loading branch information
bmf-san authored Jun 29, 2024
2 parents 1428b6e + 03b6f25 commit b12b00a
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 b12b00a

Please sign in to comment.