@marcel91200 / caddy Mirror · read-only / commits / 2182270a
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 13, 05:30 UTC

reverseproxy: Reset Content-Length to prevent FastCGI from hanging (#5435)

Fixes: https://github.com/caddyserver/caddy/issues/5420

Trea Hauet committed Mar 16, 2023 at 11:42 UTC 2182270a2cb2861f5358bb41b81caee49bb7d0dd
1 file changed +2 -1
modules/caddyhttp/reverseproxy/reverseproxy.go
+2 -1
@@ -646,7 +646,8 @@ func (h Handler) prepareRequest(req *http.Request, repl *caddy.Replacer) (*http.
646 // feature if absolutely required, if read timeouts are
647 // set, and if body size is limited
648 if h.RequestBuffers != 0 && req.Body != nil {
649 - req.Body, _ = h.bufferedBody(req.Body, h.RequestBuffers)
649 + req.Body, req.ContentLength = h.bufferedBody(req.Body, h.RequestBuffers)
650 + req.Header.Set("Content-Length", strconv.FormatInt(req.ContentLength, 10))
651 }
652
653 if req.ContentLength == 0 {