文档首页/ DDoS防护 AAD/ API参考/ DDoS高防API/ DDoS高防-防护策略/ 查询精准防护规则 - ListWafCustomRuleV2
更新时间:2026-07-01 GMT+08:00
分享

查询精准防护规则 - ListWafCustomRuleV2

功能介绍

查询精准防护规则

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

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

表1 Query参数

参数

是否必选

参数类型

描述

domain_name

String

域名

overseas_type

Integer

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

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

token

Content-Type

String

Content-Type

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

total

Integer

总数

items

Array of WafCustomRule objects

数据项

表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

表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必填且必须为以下值:client-ip:客户端IP、x-forwarded-for:X-Forwarded-For、TCP连接IP:$remote_addr

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

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

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

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:仅记录。

请求示例

查询domain_name为test.com的大陆精准防护规则

GET https://{endpoint}/v2/aad/policies/waf/custom-rule?domain_name=test.com&overseas_type=0

响应示例

状态码:200

OK

{
  "total" : 1,
  "items" : [ {
    "id" : "f2a59811-7073-xxx-xxx-xxx",
    "name" : "test",
    "time" : false,
    "priority" : 10,
    "conditions" : [ {
      "category" : "cookie",
      "index" : "123123",
      "contents" : [ "231231" ],
      "logic_operation" : "contain"
    } ],
    "action" : {
      "category" : "block"
    }
  } ]
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档