From 7d0b9208a3f9969eec3820b978acef73568dfe3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 16 Sep 2022 10:07:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97=E4=B8=AD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=BA=90=E7=AB=99=E7=8A=B6=E6=80=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 1 + internal/nodes/http_request_log.go | 1 + internal/nodes/http_request_reverse_proxy.go | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index b4d2b10..d24ad93 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -68,6 +68,7 @@ type HTTPRequest struct { filePath string // 请求的文件名,仅在读取Root目录下的内容时不为空 origin *serverconfigs.OriginConfig // 源站 originAddr string // 源站实际地址 + originStatus int32 // 源站响应代码 errors []string // 错误信息 rewriteRule *serverconfigs.HTTPRewriteRule // 匹配到的重写规则 rewriteReplace string // 重写规则的目标 diff --git a/internal/nodes/http_request_log.go b/internal/nodes/http_request_log.go index a2f71b5..93d099e 100644 --- a/internal/nodes/http_request_log.go +++ b/internal/nodes/http_request_log.go @@ -146,6 +146,7 @@ func (this *HTTPRequest) log() { if this.origin != nil { accessLog.OriginId = this.origin.Id accessLog.OriginAddress = this.originAddr + accessLog.OriginStatus = this.originStatus } // 请求Body diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index 57914cb..d018df0 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -320,6 +320,11 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId } return } + + // 记录相关数据 + this.originStatus = int32(resp.StatusCode) + + // 恢复源站状态 if !origin.IsOk { SharedOriginStateManager.Success(origin, func() { this.reverseProxy.ResetScheduling()