summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorTrea Hauet <trea@treahauet.com>2023-03-16 11:42:16 -0600
committerGitHub <noreply@github.com>2023-03-16 11:42:16 -0600
commit2182270a2cb2861f5358bb41b81caee49bb7d0dd (patch)
treec84e59f155e5d67bab0ac5676959c611af8adf6b /modules/caddyhttp
parenta7af7c486e5240da974e02b7dfee9d265aaa654a (diff)
reverseproxy: Reset Content-Length to prevent FastCGI from hanging (#5435)
Fixes: https://github.com/caddyserver/caddy/issues/5420
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 1449785..8fd24fe 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -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 {