We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4bf012c commit 8aae0b6Copy full SHA for 8aae0b6
coderd/httpmw/recover.go
@@ -15,7 +15,13 @@ func Recover(log slog.Logger) func(h http.Handler) http.Handler {
15
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
16
defer func() {
17
r := recover()
18
- if r != nil {
+
19
+ // Reverse proxying (among other things) may panic with
20
+ // http.ErrAbortHandler when the request is aborted. It's not a
21
+ // real panic so we shouldn't log them.
22
+ //
23
+ //nolint:errorlint // this is how the stdlib does the check
24
+ if r != nil && r != http.ErrAbortHandler {
25
log.Warn(context.Background(),
26
"panic serving http request (recovered)",
27
slog.F("panic", r),
0 commit comments