Commit f3108bb7 authored by Matt Holt's avatar Matt Holt Committed by GitHub

Merge pull request #1207 from tw4452852/1206

proxy: set request's body to nil explicitly
parents c2853ea6 a1dd6f0b
......@@ -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 != "" {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment