WAF增加“跳转”动作

This commit is contained in:
GoEdgeLab
2023-05-28 17:11:45 +08:00
parent 8182cfd0e0
commit 4d74e1e6ed

View File

@@ -96,6 +96,9 @@ Vue.component("http-firewall-actions-box", {
pageBody: defaultPageBody,
defaultPageBody: defaultPageBody,
redirectStatus: 307,
redirectURL: "",
goGroupName: "",
goGroupId: 0,
goGroup: null,
@@ -272,6 +275,9 @@ Vue.component("http-firewall-actions-box", {
this.pageStatus = 403
this.pageBody = this.defaultPageBody
this.redirectStatus = 307
this.redirectURL = ""
this.goGroupName = ""
this.goGroupId = 0
this.goGroup = null
@@ -398,7 +404,16 @@ Vue.component("http-firewall-actions-box", {
if (config.options.body != null) {
this.pageBody = config.options.body
}
break
case "redirect":
this.redirectStatus = 307
this.redirectURL = ""
if (config.options.status != null) {
this.redirectStatus = config.options.status
}
if (config.options.url != null) {
this.redirectURL = config.options.url
}
break
case "go_group":
if (config.options != null) {
@@ -485,6 +500,23 @@ Vue.component("http-firewall-actions-box", {
status: pageStatus,
body: this.pageBody
}
} else if (this.actionCode == "redirect") {
let redirectStatus = this.redirectStatus.toString()
if (!redirectStatus.match(/^\d{3}$/)) {
redirectStatus = 307
} else {
redirectStatus = parseInt(redirectStatus)
}
if (this.redirectURL.length == 0) {
teaweb.warn("请输入跳转到URL")
return
}
this.actionOptions = {
status: redirectStatus,
url: this.redirectURL
}
} else if (this.actionCode == "go_group") { // go_group
let groupId = this.goGroupId
if (typeof (groupId) == "string") {
@@ -832,6 +864,18 @@ Vue.component("http-firewall-actions-box", {
</td>
</tr>
<!-- redirect -->
<tr v-if="actionCode == 'redirect'">
<td>状态码 *</td>
<td><input type="text" style="width: 4em" maxlength="3" v-model="redirectStatus"/></td>
</tr>
<tr v-if="actionCode == 'redirect'">
<td>跳转到URL</td>
<td>
<input type="text" v-model="redirectURL"/>
</td>
</tr>
<!-- 规则分组 -->
<tr v-if="actionCode == 'go_group'">
<td>下一个分组 *</td>