查询单条缓存配置。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
esa:GetCacheRule |
get |
*Site
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| SiteId |
integer |
是 |
站点 ID,可通过调用 ListSites 接口获取。 |
123456**** |
| ConfigId |
integer |
是 |
配置的 ConfigId,可通过调用 ListCacheRules 接口获取 ConfigId。 |
352816096987136 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
36af3fcc-43d0-441c-86b1-428951dc8225 |
| ConfigId |
integer |
配置 ID。 |
352816096987136 |
| ConfigType |
string |
配置类型,可以根据此参数查全局配置或者规则配置,取值范围:
|
global |
| SiteVersion |
integer |
站点配置的版本号。开启了配置版本管理的站点,可以通过该参数指定配置生效的站点版本,默认为版本 0。 |
1 |
| Sequence |
integer |
规则执行顺序。数值越小越优先执行。 |
1 |
| RuleEnable |
string |
规则开关。添加全局配置的时候不需要设置该参数。取值范围:
|
on |
| Rule |
string |
规则内容,使用条件表达式来匹配用户请求。添加全局配置的时候不需要设置该参数。存在两种使用场景:
|
(http.host eq \"video.example.com\") |
| RuleName |
string |
规则名称。添加全局配置的时候不需要设置该参数。 |
rule_example |
| BypassCache |
string |
设置绕过缓存模式。取值范围:
|
cache_all |
| BrowserCacheMode |
string |
浏览器缓存模式。取值范围:
|
follow_origin |
| BrowserCacheTtl |
string |
浏览器缓存过期时间,单位是秒。 |
300 |
| EdgeCacheMode |
string |
节点缓存模式。取值范围:
|
follow_origin |
| EdgeCacheTtl |
string |
节点缓存过期时间,单位是秒。 |
300 |
| EdgeStatusCodeCacheTtl |
string |
状态码缓存过期时间,单位是秒。
|
4xx=10 |
| SortQueryStringForCache |
string |
查询字符串排序。取值范围:
|
on |
| QueryStringMode |
string |
在生成缓存键的时候,对查询字符串的处理模式。取值范围:
|
reserve_all |
| QueryString |
string |
需要保留或者删除的查询字符串,支持输入多个值,多个值之间用空格分隔。 |
example |
| IncludeHeader |
string |
生成缓存键的时候,包括指定的标头名称及其值,支持输入多个值,多个值之间用空格分隔。 |
example |
| IncludeCookie |
string |
生成缓存键的时候,包括指定的 cookie 名称及其值,支持输入多个值,多个值之间用空格分隔。 |
cookie_exapmle |
| CacheReserveEligibility |
string |
缓存保持资格。用于控制用户请求在回源的时候是否绕过缓存保持节点。取值范围:
|
bypass_cache_reserve |
| CheckPresenceHeader |
string |
生成缓存键的时候,检查 header 是否存在,如果存在,则在缓存键中加入 header 名称(header 名称不区分大小写)。支持输入多个 header 名称,多个值之间用空格分隔。 |
headername |
| CheckPresenceCookie |
string |
生成缓存键的时候,检查 cookie 是否存在,如果存在,则在缓存键中加入 cookie 名称(cookie 名称不区分大小写)。支持输入多个 cookie 名称,多个值之间用空格分隔。 |
cookiename |
| UserDeviceType |
string |
生成缓存键的时候,加入客户端设备类型。取值范围:
|
on |
| UserGeo |
string |
生成缓存键的时候,加入客户端地理位置。取值范围:
|
on |
| UserLanguage |
string |
生成缓存键的时候,加入客户端语言类型。取值范围:
|
on |
| ServeStale |
string |
响应过期缓存。开启之后,在源服务器不可用的情况下,节点依然可以使用已缓存的过期文件响应用户请求。取值范围:
|
on |
| AdditionalCacheablePorts |
string |
在指定端口上开启缓存功能。取值范围:8880、2052、2082、2086、2095、2053、2083、2087、2096。 |
2095 |
| CacheDeceptionArmor |
string |
缓存欺骗防御。用于防御 Web 缓存欺骗攻击,通过校验的缓存内容才会被缓存下来。取值范围:
|
on |
| PostCache |
string |
Post 缓存功能开关。 |
on |
| PostBodyCacheKey |
string |
缓存键的处理模式。 |
ignore |
| PostBodySizeLimit |
string |
Body 大小限制,值为数字,单位是 KB,支持 1~8KB 大小的 Body,值为空的时候,默认按 8KB 生效。 |
1 |
示例
正常返回示例
JSON格式
{
"RequestId": "36af3fcc-43d0-441c-86b1-428951dc8225",
"ConfigId": 352816096987136,
"ConfigType": "global",
"SiteVersion": 1,
"Sequence": 1,
"RuleEnable": "on",
"Rule": "(http.host eq \\\"video.example.com\\\")\n",
"RuleName": "rule_example\n",
"BypassCache": "cache_all",
"BrowserCacheMode": "follow_origin",
"BrowserCacheTtl": "300",
"EdgeCacheMode": "follow_origin",
"EdgeCacheTtl": "300",
"EdgeStatusCodeCacheTtl": "4xx=10",
"SortQueryStringForCache": "on",
"QueryStringMode": "reserve_all",
"QueryString": "example",
"IncludeHeader": "example",
"IncludeCookie": "cookie_exapmle",
"CacheReserveEligibility": "bypass_cache_reserve",
"CheckPresenceHeader": "headername",
"CheckPresenceCookie": "cookiename",
"UserDeviceType": "on",
"UserGeo": "on",
"UserLanguage": "on",
"ServeStale": "on",
"AdditionalCacheablePorts": "2095",
"CacheDeceptionArmor": "on",
"PostCache": "on",
"PostBodyCacheKey": "ignore",
"PostBodySizeLimit": "1"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InternalException | Failed to call the service. Try again later or contact technical support. | 调用服务失败,请稍后重试或联系客服咨询详情。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。