diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d79bad..f1786fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Fixed - Fix the `Vary` header value when `IMGPROXY_AUTO_JXL` or `IMGPROXY_ENFORCE_JXL` configs are set to `true`. +- Fix connection break when the `raw` processing option is used and the response status code does not allow a response body (such as `304 Not Modified`). - Fix the `If-Modified-Since` request header handling when the `raw` processing option is used. - (pro) Fix generating thumbnails for VP9 videos with high bit depth. - (pro) Fix `IMGPROXY_CUSTOM_RESPONSE_HEADERS` and `IMGPROXY_RESPONSE_HEADERS_PASSTHROUGH` configs behavior when the `raw` processing option is used. diff --git a/stream.go b/stream.go index f4a23e36..c41d458b 100644 --- a/stream.go +++ b/stream.go @@ -127,6 +127,11 @@ func streamOriginImage(ctx context.Context, reqID string, r *http.Request, rw ht defer streamBufPool.Put(buf) _, copyerr := io.CopyBuffer(rw, res.Body, *buf) + if copyerr == http.ErrBodyNotAllowed { + // We can hit this for some statuses like 304 Not Modified. + // We can ignore this error. + copyerr = nil + } router.LogResponse( reqID, r, res.StatusCode, nil,