All Products
Search
Document Center

Edge Security Acceleration:GetCacheRule

Last Updated:Nov 15, 2025
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Query a single cache configuration

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
esa:GetCacheRuleget
*Site
acs:esa:{#regionId}:{#accountId}:site/{#SiteId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
SiteIdlongYes

Site ID, which can be obtained by calling the ListSites interface.

123456****
ConfigIdlongYes

ConfigId of the configuration, which can be obtained by calling the ListCacheRules interface.

352816096987136

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

Request ID.

36af3fcc-43d0-441c-86b1-428951dc8225
ConfigIdlong

Configuration ID.

352816096987136
ConfigTypestring

Configuration type, which can be used to query global or rule configurations. Value range:

  • global: Query global configuration;
  • rule: Query rule configuration;
global
SiteVersioninteger

Version number of the site configuration. For sites with version management enabled, you can use this parameter to specify the effective version of the configuration, defaulting to version 0.

1
Sequenceinteger

Rule execution order. The smaller the value, the higher the priority.

1
RuleEnablestring

Rule switch. This parameter does not need to be set when adding a global configuration. Value range:

  • on: Enable.
  • off: Disable.
on
Rulestring

Rule content, using conditional expressions to match user requests. This parameter does not need to be set when adding a global configuration. There are two usage scenarios:

  • Match all incoming requests: Set the value to true
  • Match specific requests: Set the value to a custom expression, for example: (http.host eq "video.example.com")
(http.host eq \"video.example.com\")
RuleNamestring

Rule name. This parameter does not need to be set when adding a global configuration.

rule_example
BypassCachestring

Set bypass cache mode. Value range:

  • cache_all: Cache all requests.
  • bypass_all: Bypass cache for all requests.
cache_all
BrowserCacheModestring

Browser cache mode. Value range:

  • no_cache: Do not cache.
  • follow_origin: Follow origin cache policy.
  • override_origin: Override origin cache policy.
follow_origin
BrowserCacheTtlstring

Browser cache expiration time, in seconds.

300
EdgeCacheModestring

Edge cache mode. Value range:

  • follow_origin: Follow origin cache policy (if exists), otherwise use the default cache policy.
  • no_cache: Do not cache.
  • override_origin: Override origin cache policy.
  • follow_origin_bypass: Follow origin cache policy (if exists), otherwise do not cache.
follow_origin
EdgeCacheTtlstring

Edge cache expiration time, in seconds.

300
EdgeStatusCodeCacheTtlstring

Status code cache expiration time, in seconds.

300
SortQueryStringForCachestring

Query string sorting. Value range:

  • on: Enable.
  • off: Disable.
on
QueryStringModestring

The processing mode for query strings when generating cache keys. Value range:

  • ignore_all: Ignore all.
  • exclude_query_string: Exclude specified query strings.
  • reserve_all: Default, reserve all.
  • include_query_string: Include specified query strings.
reserve_all
QueryStringstring

The query strings to be retained or deleted, supporting multiple values separated by spaces.

example
IncludeHeaderstring

When generating the cache key, include the specified header names and their values. Supports multiple values, separated by spaces.

example
IncludeCookiestring

When generating the cache key, include the specified cookie names and their values. Supports multiple values, separated by spaces.

cookie_exapmle
CacheReserveEligibilitystring

Cache reserve eligibility. Used to control whether user requests bypass the cache reserve node when returning to the origin. Value range:

  • bypass_cache_reserve: Requests bypass the cache reserve.
  • eligible_for_cache_reserve: Eligible for cache reserve.
bypass_cache_reserve
CheckPresenceHeaderstring

When generating the cache key, check if the header exists. If it does, add the header name (header names are case-insensitive) to the cache key. Supports multiple header names, separated by spaces.

headername
CheckPresenceCookiestring

When generating the cache key, check if the cookie exists. If it does, add the cookie name (cookie names are case-insensitive) to the cache key. Supports multiple cookie names, separated by spaces.

cookiename
UserDeviceTypestring

When generating the cache key, include the client device type. Value range:

  • on: Enabled.
  • off: Disabled.
on
UserGeostring

When generating the cache key, include the client's geographic location. Value range:

  • on: Enabled.
  • off: Disabled.
on
UserLanguagestring

When generating the cache key, include the client's language type. Value range:

  • on: Enabled.
  • off: Disabled.
on
ServeStalestring

Serve stale cache. When enabled, the node can still use the cached expired files to respond to user requests even if the origin server is unavailable. Value range:

  • on: Enabled.
  • off: Disabled.
on
AdditionalCacheablePortsstring

Enable caching on the specified ports. Value range: 8880, 2052, 2082, 2086, 2095, 2053, 2083, 2087, 2096.

2095
CacheDeceptionArmorstring

Cache deception defense. Used to defend against web cache deception attacks. Only the verified cache content will be cached. Value range:

  • on: Enabled.
  • off: Disabled.
on

Examples

Sample success responses

JSONformat

{
  "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": 300,
  "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"
}

Error codes

HTTP status codeError codeError messageDescription
400InternalExceptionFailed to call the service. Try again later or contact technical support.Failed to call the service. Try again later or contact technical support.

For a list of error codes, visit the Service error codes.