Skip to content

Commit

Permalink
Merge pull request #16 from fortio/fix_ua
Browse files Browse the repository at this point in the history
Fix(workaround really) the bogus addition of user-agent: in proxy

Fixes #15 - same as golang/go#15524
  • Loading branch information
ldemailly committed Nov 7, 2022
2 parents a9c6287 + b3c49bf commit 1d9bf98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rp/reverse_proxy.go
Expand Up @@ -29,6 +29,12 @@ func GetRoutes() []config.Route {
func setDestination(req *http.Request, url *url.URL) {
req.URL.Scheme = url.Scheme
req.URL.Host = url.Host
// Horrible hack to workaround golang behavior with User-Agent: addition
// same "fix" as https://github.com/golang/go/commit/6a6c1d9841a1957a2fd292df776ea920ae38ea00
if _, ok := req.Header["User-Agent"]; !ok {
// explicitly disable User-Agent so it's not set to default value
req.Header.Set("User-Agent", "")
}
}

// Director is the object used by the ReverseProxy to pick the route/destination.
Expand Down

0 comments on commit 1d9bf98

Please sign in to comment.