From fc4b45fec7708ff5ac3e37967128c6f434efda16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 7 Jun 2023 19:28:16 +0800 Subject: [PATCH] =?UTF-8?q?HTTP=E6=9C=8D=E5=8A=A1=E5=8F=8D=E5=90=91?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=97=B6=E5=8F=AA=E6=8A=8AHTTP(S)=E6=BA=90?= =?UTF-8?q?=E7=AB=99=E5=8A=A0=E5=85=A5=E5=88=B0=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index bb55385..46b7bd0 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -283,15 +283,19 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId // 客户端取消请求,则不提示 httpErr, ok := requestErr.(*url.Error) if !ok { - SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { - this.reverseProxy.ResetScheduling() - }) + if isHTTPOrigin { + SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { + this.reverseProxy.ResetScheduling() + }) + } this.write50x(requestErr, http.StatusBadGateway, "Failed to read origin site", "源站读取失败", true) remotelogs.WarnServer("HTTP_REQUEST_REVERSE_PROXY", this.RawReq.URL.String()+": Request origin server failed: "+requestErr.Error()) } else if httpErr.Err != context.Canceled { - SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { - this.reverseProxy.ResetScheduling() - }) + if isHTTPOrigin { + SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { + this.reverseProxy.ResetScheduling() + }) + } // 是否需要重试 if (originId > 0 || (lnNodeId > 0 && hasMultipleLnNodes)) && !isLastRetry { @@ -360,7 +364,7 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId this.originStatus = int32(resp.StatusCode) // 恢复源站状态 - if !origin.IsOk { + if !origin.IsOk && isHTTPOrigin { SharedOriginStateManager.Success(origin, func() { this.reverseProxy.ResetScheduling() })