diff options
author | Matt Holt <[email protected]> | 2016-10-25 09:30:10 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2016-10-25 09:30:10 -0600 |
commit | f3108bb7bf601f6505d63515a94064a0eb3a7087 (patch) | |
tree | 00ee5b512ff4dff99bf9527426e761324aeeb9f2 /caddyhttp | |
parent | c2853ea64b3b4ef2a60fbe271f3c8c0adf57cbbb (diff) | |
parent | a1dd6f0b348367a93cd61ff2cf3654dbbb8e2743 (diff) | |
download | caddy-f3108bb7bf601f6505d63515a94064a0eb3a7087.tar.gz caddy-f3108bb7bf601f6505d63515a94064a0eb3a7087.zip |
Merge pull request #1207 from tw4452852/1206
proxy: set request's body to nil explicitly
Diffstat (limited to 'caddyhttp')
-rw-r--r-- | caddyhttp/proxy/proxy.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/caddyhttp/proxy/proxy.go b/caddyhttp/proxy/proxy.go index fc2d727fa..a46ea71a6 100644 --- a/caddyhttp/proxy/proxy.go +++ b/caddyhttp/proxy/proxy.go @@ -218,6 +218,11 @@ func (p Proxy) match(r *http.Request) Upstream { func createUpstreamRequest(r *http.Request) *http.Request { outreq := new(http.Request) *outreq = *r // includes shallow copies of maps, but okay + // We should set body to nil explicitly if request body is empty. + // For server requests the Request Body is always non-nil. + if r.ContentLength == 0 { + outreq.Body = nil + } // Restore URL Path if it has been modified if outreq.URL.RawPath != "" { |