更新时间:2025-06-09 GMT+08:00
分享

查询精准防护规则

功能介绍

查询精准防护规则

调用方法

请参见如何调用API

URI

GET /v2/aad/policies/waf/custom-rule

表1 Query参数

参数

是否必选

参数类型

描述

domain_name

String

域名

overseas_type

Integer

防护区域

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

token

Content-Type

String

Content-Type

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

total

Integer

total

items

Array of WafCustomRule objects

items

表4 WafCustomRule

参数

参数类型

描述

id

String

id

name

String

name

time

Boolean

精准防护规则生效时间。true-自定义生效时间,false-立即生效

start

Long

精准防护规则生效的起始时间戳(秒)

terminal

Long

精准防护规则生效的终止时间戳(秒)

priority

Integer

执行该规则的优先级,值越小,优先级越高。取值范围:0到1000。

conditions

Array of WafCustomCondition objects

condition

action

WafCustomRuleAction object

action

domain_name

String

域名

overseas_type

Integer

防护区域,0-大陆,1-海外

表5 WafCustomCondition

参数

参数类型

描述

category

String

字段类型

枚举值:

url:路径

ip:IPv4

user-agent: User Agent

method: Method

referer: Referer

params:Params

cookie:Cookie

header:Header

request_line: Request Line

request: Request

index

String

子字段

  • 当字段类型为url,user-agent、refer、request_line、method、request时,不需要传index参数

  • 当字段类型为ip或ipv6时,index必填且必须为以下值:

  • 当字段类型(category)选择“params”、“cookie”、“header”时,请根据实际需求配置子字段且该参数必填。

  • 当匹配逻辑为num_greater、num_less、num_equal、num_not_equal时,子字段必须为空

  • 当子字段不为空时,最大长度不超过2048

client-ip:客户端IP

x-forwarded-for:X-Forwarded-For

TCP连接IP: $remote_addr

logic_operation

String

条件列表匹配逻辑。

如果字段类型category是url、user-agent或者referer, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal或者len_not_equal

如果字段类型category是ip、ipv6或method,匹配逻辑可以为: equal、not_equal

如果字段类型category是request_line或者request, 匹配逻辑可以为: len_greater、len_less、len_equal或者len_not_equal

如果字段类型category是params、cookie或者header, 匹配逻辑可以为:contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal、len_not_equal、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist

contents

Array of strings

条件列表逻辑匹配内容。

  • 当匹配逻辑为exist或not_exist时,contents必须为空,其他情况下contents必填且长度不超过2048

  • 当匹配逻辑包含"len"时,contents必须为0~65535的整数;当匹配逻辑包含"num"时,contents必须为0~512的整数

  • 当category为method时, contents必须是1-64位大写字母

表6 WafCustomRuleAction

参数

参数类型

描述

category

String

防护动作。

“block”:拦截。

“pass”:放行。

“log”:仅记录

请求示例

响应示例

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档