1. 接口描述
接口请求域名: teo.tencentcloudapi.com 。
本接口用于查询规则引擎的规则列表。
默认接口请求频率限制:20次/秒。
推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
Action | 是 | String | 公共参数,本接口取值:DescribeL7AccRules。 |
Version | 是 | String | 公共参数,本接口取值:2022-09-01。 |
Region | 否 | String | 公共参数,此参数为可选参数。 |
ZoneId | 是 | String | 站点 ID。 |
Filters.N | 否 | Array of Filter | 过滤条件,Filters.Values 的上限为 20,不填写此参数时默认按顺序返回站点下的规则。详细的过滤条件如下: |
Limit | 否 | Integer | 分页查询限制数目,默认值:20,上限:1000。 |
Offset | 否 | Integer | 分页查询偏移量,默认为 0。 |
3. 输出参数
参数名称 | 类型 | 描述 |
---|---|---|
TotalCount | Integer | 规则总数。 |
Rules | Array of RuleEngineItem | 规则列表,规则按照从上到下的顺序执行,详情参考规则生效优先级。 注意:此字段可能返回 null,表示取不到有效值。 |
RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 查询规则引擎规则列表
查询规则引擎规则列表。
输入示例
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeL7AccRules
<公共请求参数>
{
"ZoneId": "zone-27q0p0lali12"
}
输出示例
{
"Response": {
"TotalCount": 1,
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03",
"Rules": [
{
"RuleName": "测试规则",
"Status": "disable",
"RuleId": "rule-djuq23",
"Description": [
"注释 1",
"注释 2"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "ModifyOrigin",
"ModifyOriginParameters": {
"OriginType": "IPDomain",
"Origin": "1.1.1.1",
"OriginProtocol": "follow",
"HTTPOriginPort": 80,
"HTTPSOriginPort": 443
}
}
],
"SubRules": [
{
"Description": [
"节点缓存TTL示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "Cache",
"CacheParameters": {
"FollowOrigin": {
"Switch": "on",
"DefaultCache": "on",
"DefaultCacheStrategy": "on",
"DefaultCacheTime": 0
}
}
}
]
}
]
},
{
"Description": [
"浏览器缓存TTL示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "MaxAge",
"MaxAgeParameters": {
"FollowOrigin": "off",
"CacheTime": 0
}
}
]
}
]
},
{
"Description": [
"自定义CacheKey示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "CacheKey",
"CacheKeyParameters": {
"FullURLCache": "off",
"QueryString": {
"Switch": "on",
"Action": "includeCustom",
"Values": [
"name1",
"name2"
]
},
"IgnoreCase": "on",
"Header": {
"Switch": "on",
"Values": [
"EO-Client-Device",
"EO-Client-OS"
]
},
"Scheme": "on",
"Cookie": {
"Switch": "off"
}
}
}
]
}
]
},
{
"Description": [
"状态码缓存TTL示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "StatusCodeCache",
"StatusCodeCacheParameters": {
"StatusCodeCacheParams": [
{
"StatusCode": 400,
"CacheTime": 4
},
{
"StatusCode": 401,
"CacheTime": 180
},
{
"StatusCode": 403,
"CacheTime": 7200
},
{
"StatusCode": 404,
"CacheTime": 86400
}
]
}
}
]
}
]
},
{
"Description": [
"缓存预刷新示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "CachePrefresh",
"CachePrefreshParameters": {
"Switch": "on",
"CacheTimePercent": 80
}
}
]
}
]
},
{
"Description": [
"离线缓存示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "OfflineCache",
"OfflineCacheParameters": {
"Switch": "on"
}
}
]
}
]
},
{
"Description": [
"HTTP2示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "HTTP2",
"HTTP2Parameters": {
"Switch": "on"
}
}
]
}
]
},
{
"Description": [
"QUIC示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "QUIC",
"QUICParameters": {
"Switch": "on"
}
}
]
}
]
},
{
"Description": [
"WebSocket示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "WebSocket",
"WebSocketParameters": {
"Switch": "on",
"Timeout": 30
}
}
]
}
]
},
{
"Description": [
"最大上传大小示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "PostMaxSize",
"PostMaxSizeParameters": {
"Switch": "on",
"MaxSize": 524288000
}
}
]
}
]
},
{
"Description": [
"智能压缩示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "Compression",
"CompressionParameters": {
"Switch": "on",
"Algorithms": [
"gzip"
]
}
}
]
}
]
},
{
"Description": [
"智能加速示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "SmartRouting",
"SmartRoutingParameters": {
"Switch": "on"
}
}
]
}
]
},
{
"Description": [
"HTTP2回源示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "UpstreamHTTP2",
"UpstreamHTTP2Parameters": {
"Switch": "off"
}
}
]
}
]
},
{
"Description": [
"回源超时时间示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "HTTPUpstreamTimeout",
"HTTPUpstreamTimeoutParameters": {
"ResponseTimeout": 15
}
}
]
}
]
},
{
"Description": [
"强制 HTTPS示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "ForceRedirectHTTPS",
"ForceRedirectHTTPSParameters": {
"Switch": "on",
"RedirectStatusCode": 302
}
}
]
}
]
},
{
"Description": [
"HSTS示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "HSTS",
"HSTSParameters": {
"Switch": "on",
"Timeout": 1000,
"IncludeSubDomains": "on",
"Preload": "on"
}
}
]
}
]
},
{
"Description": [
"SSL/TLS 安全配置示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "TLSConfig",
"TLSConfigParameters": {
"Version": [
"TLSv1",
"TLSv1.1",
"TLSv1.2",
"TLSv1.3"
],
"CipherSuite": "loose-v2023"
}
}
]
}
]
},
{
"Description": [
"OCSP 装订示例",
"回源请求参数设置示例",
"回源跟随重定向示例",
"自定义错误页面示例",
"分片回源示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "OCSPStapling",
"OCSPStaplingParameters": {
"Switch": "on"
}
},
{
"Name": "UpstreamRequest",
"UpstreamRequestParameters": {
"QueryString": {
"Switch": "on",
"Action": "includeCustom",
"Values": [
"name1",
"name2"
]
},
"Cookie": {
"Switch": "on",
"Action": "full"
}
}
},
{
"Name": "UpstreamFollowRedirect",
"UpstreamFollowRedirectParameters": {
"Switch": "on",
"MaxTimes": 3
}
},
{
"Name": "ErrorPage",
"ErrorPageParameters": {
"ErrorPageParams": [
{
"StatusCode": 400,
"RedirectURL": "http://www.test-v.com/custom-page.html"
},
{
"StatusCode": 403,
"RedirectURL": "http://www.test-v.com/custom-page1.html"
}
]
}
},
{
"Name": "RangeOriginPull",
"RangeOriginPullParameters": {
"Switch": "on"
}
}
]
}
]
},
{
"Description": [
"回源 HTTPS示例",
"修改 HTTP 回源请求头示例",
"Host Header 重写示例",
"访问 URL 重定向示例",
"Token 鉴权示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "OriginPullProtocol"
},
{
"Name": "ModifyRequestHeader",
"ModifyRequestHeaderParameters": {
"HeaderActions": [
{
"Action": "add",
"Name": "EO-Client-Browser"
},
{
"Action": "del",
"Name": "EO-Client-Device"
},
{
"Action": "set",
"Name": "EO-Client-OS"
}
]
}
},
{
"Name": "HostHeader",
"HostHeaderParameters": {
"Action": "followOrigin"
}
},
{
"Name": "AccessURLRedirect",
"AccessURLRedirectParameters": {
"StatusCode": 302,
"Protocol": "follow",
"HostName": {
"Action": "follow"
},
"URLPath": {
"Action": "follow"
},
"QueryString": {
"Action": "full"
}
}
},
{
"Name": "Authentication",
"AuthenticationParameters": {
"AuthType": "TypeA",
"Timeout": 5,
"SecretKey": "BCChgIM4o0k08Uk0Jgi3f27ir3",
"BackupSecretKey": "3deJ7O6CsqlIk",
"AuthParam": "test123QQ"
}
}
]
}
]
},
{
"Description": [
"修改 HTTP 节点响应头示例",
"客户端 IP 头部示例",
"客户端 IP 地理位置头部示例",
"HTTP 应答示例",
"回源 URL 重写示例"
],
"Branches": [
{
"Condition": "${http.request.host} in ['www.example.com']",
"Actions": [
{
"Name": "ModifyResponseHeader",
"ModifyResponseHeaderParameters": {
"HeaderActions": [
{
"Action": "add",
"Name": "Access-Control-Allow-Methods",
"Value": "POST,GET"
},
{
"Action": "set",
"Name": "Access-Control-Allow-Origin",
"Value": "http://test.com,http://1.1.1.1"
},
{
"Action": "del",
"Name": "Content-Disposition"
}
]
}
},
{
"Name": "ClientIPHeader",
"ClientIPHeaderParameters": {
"Switch": "on",
"HeaderName": "testheader"
}
},
{
"Name": "ClientIPCountry",
"ClientIPCountryParameters": {
"Switch": "on",
"HeaderName": "EO-Client-IPCountry"
}
},
{
"Name": "HttpResponse",
"HttpResponseParameters": {
"StatusCode": 400,
"ResponsePage": "p-30tcxgl8i0ls"
}
},
{
"Name": "UpstreamURLRewrite",
"UpstreamURLRewriteParameters": {
"Type": "Path",
"Action": "addPrefix",
"Value": "/prefix"
}
}
]
}
]
}
]
}
]
}
]
}
}
5. 开发者资源
腾讯云 API 平台
腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。
API Inspector
用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。
SDK
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
- Tencent Cloud SDK 3.0 for Python: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Java: GitHub, Gitee
- Tencent Cloud SDK 3.0 for PHP: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Go: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Node.js: GitHub, Gitee
- Tencent Cloud SDK 3.0 for .NET: GitHub, Gitee
- Tencent Cloud SDK 3.0 for C++: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Ruby: GitHub, Gitee
命令行工具
6. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
错误码 | 描述 |
---|---|
InternalError.RouteError | 后端服务路由地址错误。 |
UnauthorizedOperation.CamUnauthorized | Cam 未授权。 |
UnauthorizedOperation.Unknown | 后端服务器发生未知错误。 |