From ef5a15f5c3f13d038ffdf3b1cf397903b6779683 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Sun, 10 Sep 2023 15:20:51 +0100 Subject: [PATCH] Close incoming request body in redirect anyway --- target/redirect.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/redirect.go b/target/redirect.go index 8af1e83..12340d1 100644 --- a/target/redirect.go +++ b/target/redirect.go @@ -60,6 +60,11 @@ func (r Redirect) ServeHTTP(rw http.ResponseWriter, req *http.Request) { Path: p, } + // close the incoming body after use + if req.Body != nil { + defer req.Body.Close() + } + // use fast redirect for speed utils.FastRedirect(rw, req, u.String(), code) }