实现WAF

This commit is contained in:
GoEdgeLab
2020-10-08 15:06:42 +08:00
parent b4cfc33875
commit 4245c73c47
110 changed files with 8179 additions and 3 deletions

View File

@@ -96,7 +96,11 @@ func (this *HTTPRequest) Do() {
}
// WAF
// TODO 需要实现
if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn && this.web.FirewallPolicy != nil && this.web.FirewallPolicy.IsOn {
if this.doWAFRequest() {
return
}
}
// 访问控制
// TODO 需要实现
@@ -253,6 +257,12 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo
this.web.Cache = web.Cache
}
// waf
if web.FirewallRef != nil && (web.FirewallRef.IsPrior || isTop) {
this.web.FirewallRef = web.FirewallRef
this.web.FirewallPolicy = web.FirewallPolicy
}
// 重写规则
if len(web.RewriteRefs) > 0 {
for index, ref := range web.RewriteRefs {