@marcel91200 / caddy Mirror · read-only / commits / 4de2c1c6
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 20:45 UTC

panic when reading from backend failed to propagate stream error (#5952)

WeidiDeng committed Nov 23, 2023 at 16:18 UTC 4de2c1c65e48a68046817bdc074a25c1750fd38d
1 file changed +5 -3
modules/caddyhttp/reverseproxy/reverseproxy.go
+5 -3
@@ -962,10 +962,12 @@ func (h *Handler) finalizeResponse(
962 if err != nil {
963 // we're streaming the response and we've already written headers, so
964 // there's nothing an error handler can do to recover at this point;
965 - // the standard lib's proxy panics at this point, but we'll just log
966 - // the error and abort the stream here
965 + // we'll just log the error and abort the stream here and panic just as
966 + // the standard lib's proxy to propagate the stream error.
967 + // see issue https://github.com/caddyserver/caddy/issues/5951
968 logger.Error("aborting with incomplete response", zap.Error(err))
968 - return nil
969 + // no extra logging from stdlib
970 + panic(http.ErrAbortHandler)
971 }
972
973 if len(res.Trailer) > 0 {