summaryrefslogtreecommitdiffhomepage
path: root/caddyhttp
diff options
context:
space:
mode:
authorMatt Holt <[email protected]>2016-10-25 09:30:10 -0600
committerGitHub <[email protected]>2016-10-25 09:30:10 -0600
commitf3108bb7bf601f6505d63515a94064a0eb3a7087 (patch)
tree00ee5b512ff4dff99bf9527426e761324aeeb9f2 /caddyhttp
parentc2853ea64b3b4ef2a60fbe271f3c8c0adf57cbbb (diff)
parenta1dd6f0b348367a93cd61ff2cf3654dbbb8e2743 (diff)
downloadcaddy-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.go5
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 != "" {