mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-08 03:00:27 +08:00
提升健康检查和UAM优先级
This commit is contained in:
@@ -164,6 +164,16 @@ func (this *HTTPRequest) Do() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理健康检查
|
||||||
|
var isHealthCheck = false
|
||||||
|
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
|
||||||
|
if len(healthCheckKey) > 0 {
|
||||||
|
if this.doHealthCheck(healthCheckKey, &isHealthCheck) {
|
||||||
|
this.doEnd()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !this.isLnRequest {
|
if !this.isLnRequest {
|
||||||
// 特殊URL处理
|
// 特殊URL处理
|
||||||
if len(this.rawURI) > 1 && this.rawURI[1] == '.' {
|
if len(this.rawURI) > 1 && this.rawURI[1] == '.' {
|
||||||
@@ -191,6 +201,24 @@ func (this *HTTPRequest) Do() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UAM
|
||||||
|
if !isHealthCheck {
|
||||||
|
if this.web.UAM != nil {
|
||||||
|
if this.web.UAM.IsOn {
|
||||||
|
if this.doUAM() {
|
||||||
|
this.doEnd()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn {
|
||||||
|
this.web.UAM = this.ReqServer.UAM
|
||||||
|
if this.doUAM() {
|
||||||
|
this.doEnd()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WAF
|
// WAF
|
||||||
if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn {
|
if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn {
|
||||||
if this.doWAFRequest() {
|
if this.doWAFRequest() {
|
||||||
@@ -262,33 +290,6 @@ func (this *HTTPRequest) doBegin() {
|
|||||||
this.RawReq.Body = ioutil.NopCloser(io.MultiReader(bytes.NewBuffer(this.requestBodyData), this.RawReq.Body))
|
this.RawReq.Body = ioutil.NopCloser(io.MultiReader(bytes.NewBuffer(this.requestBodyData), this.RawReq.Body))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理健康检查
|
|
||||||
var isHealthCheck = false
|
|
||||||
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
|
|
||||||
if len(healthCheckKey) > 0 {
|
|
||||||
if this.doHealthCheck(healthCheckKey, &isHealthCheck) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UAM
|
|
||||||
if !isHealthCheck {
|
|
||||||
if this.web.UAM != nil {
|
|
||||||
if this.web.UAM.IsOn {
|
|
||||||
if this.doUAM() {
|
|
||||||
this.doEnd()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn {
|
|
||||||
this.web.UAM = this.ReqServer.UAM
|
|
||||||
if this.doUAM() {
|
|
||||||
this.doEnd()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 跳转
|
// 跳转
|
||||||
if len(this.web.HostRedirects) > 0 {
|
if len(this.web.HostRedirects) > 0 {
|
||||||
if this.doHostRedirect() {
|
if this.doHostRedirect() {
|
||||||
|
|||||||
Reference in New Issue
Block a user