mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:40:25 +08:00
WAF策略增加显示页面动作默认设置
This commit is contained in:
@@ -2,7 +2,7 @@ package firewallconfigs
|
||||
|
||||
import "net/http"
|
||||
|
||||
// HTTPFirewallBlockAction url client configure
|
||||
// HTTPFirewallBlockAction default block action
|
||||
type HTTPFirewallBlockAction struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
|
||||
|
||||
@@ -5,6 +5,12 @@ import (
|
||||
)
|
||||
|
||||
var AllActions = []*HTTPFirewallActionDefinition{
|
||||
{
|
||||
Name: "显示网页",
|
||||
Code: HTTPFirewallActionPage,
|
||||
Description: "显示请求被拦截的网页。",
|
||||
Category: HTTPFirewallActionCategoryBlock,
|
||||
},
|
||||
{
|
||||
Name: "阻止",
|
||||
Code: HTTPFirewallActionBlock,
|
||||
@@ -29,12 +35,6 @@ var AllActions = []*HTTPFirewallActionDefinition{
|
||||
Description: "将此IP记录到某个IP名单中。",
|
||||
Category: HTTPFirewallActionCategoryBlock,
|
||||
},
|
||||
{
|
||||
Name: "显示网页",
|
||||
Code: HTTPFirewallActionPage,
|
||||
Description: "在网页中显示提示文字。",
|
||||
Category: HTTPFirewallActionCategoryBlock,
|
||||
},
|
||||
{
|
||||
Name: "跳转",
|
||||
Code: HTTPFirewallActionRedirect,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package firewallconfigs
|
||||
|
||||
import "net/http"
|
||||
|
||||
// HTTPFirewallPageAction default page action
|
||||
type HTTPFirewallPageAction struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
|
||||
Status int `yaml:"status" json:"status"`
|
||||
Body string `yaml:"body" json:"body"`
|
||||
}
|
||||
|
||||
|
||||
func DefaultHTTPFirewallPageAction() *HTTPFirewallPageAction {
|
||||
return &HTTPFirewallPageAction{
|
||||
Status: http.StatusForbidden,
|
||||
Body: `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
<style>
|
||||
address { line-height: 1.8; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 Forbidden By WAF</h1>
|
||||
<address>Connection: ${remoteAddr} (Client) -> ${serverAddr} (Server)</address>
|
||||
<address>Request ID: ${requestId}</address>
|
||||
</body>
|
||||
</html>`,
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ type HTTPFirewallPolicy struct {
|
||||
Outbound *HTTPFirewallOutboundConfig `yaml:"outbound" json:"outbound"`
|
||||
BlockOptions *HTTPFirewallBlockAction `yaml:"blockOptions" json:"blockOptions"`
|
||||
CaptchaOptions *HTTPFirewallCaptchaAction `yaml:"captchaOptions" json:"captchaOptions"`
|
||||
PageOptions *HTTPFirewallPageAction `yaml:"pageOptions" json:"pageOptions"`
|
||||
Mode FirewallMode `yaml:"mode" json:"mode"`
|
||||
UseLocalFirewall bool `yaml:"useLocalFirewall" json:"useLocalFirewall"`
|
||||
SYNFlood *SYNFloodConfig `yaml:"synFlood" json:"synFlood"`
|
||||
|
||||
Reference in New Issue
Block a user