Skip to content

Commit

Permalink
cmd/coordinator: make gomote proxy 502 error include detail
Browse files Browse the repository at this point in the history
Go 1.11 added ReverseProxy.ErrorHandler; use it to make the
httputil.ReverseProxy failures print the underlying error back to the
(trusted) client. (Normally the client isn't necessarily trusted
enough to get the full info)

Also, log more to stderr where we can search for it.

Updates golang/go#28365

Change-Id: Iac2d863b159f24fda2e0e6e1f7374ed05434d3e4
Reviewed-on: https://go-review.googlesource.com/c/build/+/200738
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
bradfitz authored and codebien committed Nov 13, 2019
1 parent c72e3ab commit 38b71db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/coordinator/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ func proxyBuildletHTTP(w http.ResponseWriter, r *http.Request) {
Director: func(*http.Request) {}, // nothing
Transport: rb.buildlet.ProxyRoundTripper(),
FlushInterval: 500 * time.Millisecond,
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {
log.Printf("gomote proxy error for %s: %v", buildletName, err)
w.WriteHeader(http.StatusBadGateway)
fmt.Fprintf(w, "(golang.org/issue/28365): gomote proxy error: %v", err)
},
}
proxy.ServeHTTP(w, outReq)
}
Expand Down

0 comments on commit 38b71db

Please sign in to comment.