优化源站调度

This commit is contained in:
GoEdgeLab
2021-08-01 21:56:02 +08:00
parent e723a64e68
commit 8d49c380d7
5 changed files with 244 additions and 34 deletions

View File

@@ -160,6 +160,9 @@ func (this *HTTPRequest) doReverseProxy() {
httpErr, ok := err.(*url.Error)
if !ok || httpErr.Err != context.Canceled {
// TODO 如果超过最大失败次数,则下线
SharedOriginStateManager.Fail(origin, this.reverseProxy, func() {
this.reverseProxy.ResetScheduling()
})
this.write502(err)
remotelogs.Warn("HTTP_REQUEST_REVERSE_PROXY", this.RawReq.URL.String()+"': "+err.Error())
@@ -183,6 +186,11 @@ func (this *HTTPRequest) doReverseProxy() {
}
return
}
if !origin.IsOk {
SharedOriginStateManager.Success(origin, func() {
this.reverseProxy.ResetScheduling()
})
}
// WAF对出站进行检查
if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn {