mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-09 03:50:27 +08:00
访问日志中增加源站状态码
This commit is contained in:
@@ -68,6 +68,7 @@ type HTTPRequest struct {
|
||||
filePath string // 请求的文件名,仅在读取Root目录下的内容时不为空
|
||||
origin *serverconfigs.OriginConfig // 源站
|
||||
originAddr string // 源站实际地址
|
||||
originStatus int32 // 源站响应代码
|
||||
errors []string // 错误信息
|
||||
rewriteRule *serverconfigs.HTTPRewriteRule // 匹配到的重写规则
|
||||
rewriteReplace string // 重写规则的目标
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user