WAF策略可以自定义默认的区域/省份封禁提示

This commit is contained in:
GoEdgeLab
2023-08-10 10:30:38 +08:00
parent 04ae7d86b3
commit b3939083c0
8 changed files with 41 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ func (this *PolicyAction) RunGet(params struct {
return
}
internalGroups := []maps.Map{}
var internalGroups = []maps.Map{}
if firewallPolicy.Inbound != nil {
for _, group := range firewallPolicy.Inbound.Groups {
internalGroups = append(internalGroups, maps.Map{
@@ -101,6 +101,8 @@ func (this *PolicyAction) RunGet(params struct {
"log": firewallPolicy.Log,
"maxRequestBodySize": firewallPolicy.MaxRequestBodySize,
"maxRequestBodySizeFormat": numberutils.FormatBytes(firewallPolicy.MaxRequestBodySize),
"denyCountryHTML": firewallPolicy.DenyCountryHTML,
"denyProvinceHTML": firewallPolicy.DenyProvinceHTML,
}
// 正在使用此策略的集群

View File

@@ -76,6 +76,8 @@ func (this *UpdateAction) RunGet(params struct {
"synFloodConfig": firewallPolicy.SYNFlood,
"log": firewallPolicy.Log,
"maxRequestBodySize": types.String(firewallPolicy.MaxRequestBodySize),
"denyCountryHTML": firewallPolicy.DenyCountryHTML,
"denyProvinceHTML": firewallPolicy.DenyProvinceHTML,
}
// 预置分组
@@ -113,6 +115,8 @@ func (this *UpdateAction) RunPost(params struct {
SynFloodJSON []byte
LogJSON []byte
MaxRequestBodySize int64
DenyCountryHTML string
DenyProvinceHTML string
Must *actions.Must
}) {
@@ -155,6 +159,8 @@ func (this *UpdateAction) RunPost(params struct {
SynFloodJSON: params.SynFloodJSON,
LogJSON: params.LogJSON,
MaxRequestBodySize: params.MaxRequestBodySize,
DenyCountryHTML: params.DenyCountryHTML,
DenyProvinceHTML: params.DenyProvinceHTML,
})
if err != nil {
this.ErrorPage(err)