From 2f77137b893f48693cc68e4efc68b663c0dae114 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 7 Jun 2023 20:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DUser-Agent=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=BD=BF=E7=94=A8=E4=BA=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9A=84Go-http-client/1.1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index cc59b6b..a938ce1 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -257,9 +257,17 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId return } + + var resp *http.Response var requestErr error if isHTTPOrigin { // 普通HTTP(S)源站 + // 修复空User-Agent问题 + _, existsUserAgent := this.RawReq.Header["User-Agent"] + if !existsUserAgent { + this.RawReq.Header["User-Agent"] = []string{""} + } + // 获取请求客户端 client, err := SharedHTTPClientPool.Client(this, origin, originAddr, this.reverseProxy.ProxyProtocol, this.reverseProxy.FollowRedirects) if err != nil {