From 46bfd707749ff1280c04267c3a2d1cd82eab14ff Mon Sep 17 00:00:00 2001 From: Julian Nodorp Date: Sun, 10 Apr 2022 00:51:18 +0200 Subject: [PATCH] fix: log proxy errors with logrus (#937) --- cmd/server/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/server/server.go b/cmd/server/server.go index 07e78da7d6..a912bbf886 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -40,6 +40,10 @@ func runProxy(d driver.Driver, n *negroni.Negroni, logger *logrusx.Logger, prom handler := &httputil.ReverseProxy{ Director: proxy.Director, Transport: proxy, + ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) { + logger.WithError(err).Errorf("http: proxy error: %v", err) + w.WriteHeader(http.StatusBadGateway) + }, } promCollapsePaths := d.Configuration().PrometheusCollapseRequestPaths()