mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
proxy: set request's body to nil explicitly
fix issue #1206 Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
parent
3c1957a612
commit
a1dd6f0b34
1 changed files with 5 additions and 0 deletions
|
@ -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 != "" {
|
||||
|
|
Loading…
Reference in a new issue