From a8c8d80e3b37417b27f1587fbb5189b68f390728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sun, 18 Jun 2023 18:05:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=A0=B9=E6=8D=AE=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E5=8F=B7=E8=87=AA=E5=8A=A8=E7=BA=A0=E6=AD=A3=E6=BA=90?= =?UTF-8?q?=E7=AB=99=E5=9C=B0=E5=9D=80=E4=B8=AD=E7=9A=84scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index ee4f409..b0ac09c 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -275,6 +275,13 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId return } + // 尝试自动纠正源站地址中的scheme + if this.RawReq.URL.Scheme == "http" && strings.HasSuffix(originAddr, ":443") { + this.RawReq.URL.Scheme = "https" + } else if this.RawReq.URL.Scheme == "https" && strings.HasSuffix(originAddr, ":80") { + this.RawReq.URL.Scheme = "http" + } + // 开始请求 resp, requestErr = client.Do(this.RawReq) } else if origin.OSS != nil { // OSS源站