Skip to content

Commit daef9c3

Browse files
minor fix
1 parent 8b01347 commit daef9c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

proxy/proxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
270270
Path: req.URL.Path,
271271
RawQuery: req.URL.RawQuery,
272272
}
273-
newReq, err := http.NewRequest(req.Method, targetURL.String(), nil)
273+
var body io.ReadCloser = req.Body
274+
if req.Method == http.MethodGet || req.Method == http.MethodHead {
275+
body = nil
276+
}
277+
newReq, err := http.NewRequest(req.Method, targetURL.String(), body)
274278
if err != nil {
275279
p.logger.Error("can't create http request", "error", err)
276280
return

0 commit comments

Comments
 (0)