From cf52510399c9d013ea0cde11735bbb58a8d85180 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 19 Apr 2021 19:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8HTTP/2=E4=B8=AD?= =?UTF-8?q?=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?411=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index bed3974..7791858 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -147,6 +147,12 @@ func (this *HTTPRequest) doReverseProxy() { return } + // 在HTTP/2下需要防止因为requestBody而导致Content-Length为空的问题 + if this.RawReq.ProtoMajor == 2 && this.RawReq.ContentLength == 0 { + _ = this.RawReq.Body.Close() + this.RawReq.Body = nil + } + // 开始请求 resp, err := client.Do(this.RawReq) if err != nil {