Commit 14f5db64 authored by Nick Thomas's avatar Nick Thomas

Don't log http.ErrAbortHandler panics in sentry

parent fd81eeb2
...@@ -47,5 +47,16 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -47,5 +47,16 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
helper.AllowResponseBuffering(w) helper.AllowResponseBuffering(w)
} }
// If the ultimate client disconnects when the response isn't fully written
// to them yet, httputil.ReverseProxy panics with a net/http.ErrAbortHandler
// error. We can catch and discard this to keep the error log clean
defer func() {
if err := recover(); err != nil {
if err != http.ErrAbortHandler {
panic(err)
}
}
}()
p.reverseProxy.ServeHTTP(w, &req) p.reverseProxy.ServeHTTP(w, &req)
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment