Skip to content

Commit

Permalink
reverseproxy: Reset Content-Length to prevent FastCGI from hanging (#…
Browse files Browse the repository at this point in the history
…5435)

Fixes: #5420
  • Loading branch information
trea authored Mar 16, 2023
1 parent a7af7c4 commit 2182270
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/caddyhttp/reverseproxy/reverseproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ func (h Handler) prepareRequest(req *http.Request, repl *caddy.Replacer) (*http.
// feature if absolutely required, if read timeouts are
// set, and if body size is limited
if h.RequestBuffers != 0 && req.Body != nil {
req.Body, _ = h.bufferedBody(req.Body, h.RequestBuffers)
req.Body, req.ContentLength = h.bufferedBody(req.Body, h.RequestBuffers)
req.Header.Set("Content-Length", strconv.FormatInt(req.ContentLength, 10))
}

if req.ContentLength == 0 {
Expand Down

0 comments on commit 2182270

Please sign in to comment.