Listing Rules in the Rules Engine
Function
This API is used to list rules in the rules engine.
Calling Method
For details, see Calling APIs.
URI
GET /v1.0/cdn/configuration/domains/{domain_name}/rules
| 
         Parameter  | 
       
         Mandatory  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|---|
| 
         domain_name  | 
       
         Yes  | 
       
         String  | 
       
         Definition Acceleration domain name. Constraints N/A Range N/A Default Value N/A  | 
      
Request Parameters
None
Response Parameters
Status code: 200
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         rules  | 
       
         Array of RuleResponse objects  | 
       
         Rule list.  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         rule_id  | 
       
         String  | 
       
         Rule ID.  | 
      
| 
         name  | 
       
         String  | 
       
         Rule name.  | 
      
| 
         status  | 
       
         String  | 
       
         Rule status. The value can be on (enabled) or off (disabled).  | 
      
| 
         priority  | 
       
         Integer  | 
       
         Rule priority. A larger value indicates a higher priority.  | 
      
| 
         conditions  | 
       
         Conditions object  | 
       
         Definition Conditions for triggering the rule. Constraints N/A  | 
      
| 
         actions  | 
       
         Array of Actions objects  | 
       
         Actions to be executed when the rule conditions are met.  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         match  | 
       
         Match object  | 
       
         Definition Rule conditions. Constraints N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         logic  | 
       
         String  | 
       
         Definition Logical operator. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         criteria  | 
       
         Array of Criteria objects  | 
       
         Definition Match condition list. Constraints N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         match_target_type  | 
       
         String  | 
       
         Definition Match target type. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         match_target_name  | 
       
         String  | 
       
         Definition Match target name. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         match_type  | 
       
         String  | 
       
         Definition Match algorithm. Constraints N/A Range contains: Any condition specified in match_pattern is matched. Default Value N/A  | 
      
| 
         match_pattern  | 
       
         Array of strings  | 
       
         Definition Match content. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         negate  | 
       
         Boolean  | 
       
         Definition Whether to perform negation. This parameter is used together with match_type. For example, if negate is set to true and match_type is set to contains, the actual service logic is converted to not_contains. Constraints N/A Range 
 Default Value false  | 
      
| 
         case_sensitive  | 
       
         Boolean  | 
       
         Definition Case insensitive or not. Constraints N/A Range 
 Default Value false  | 
      
| 
         logic  | 
       
         String  | 
       
         Definition Nested condition logic operator. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         criteria  | 
       
         Array of Criteria objects  | 
       
         Definition Nested condition list. Constraints N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         flexible_origin  | 
       
         Array of flexibleOriginsEngine objects  | 
       
         Definition Advanced origin rules. CDN can pull content from different origin servers by resource type or path. Constraints Up to 20 rules.  | 
      
| 
         origin_request_header  | 
       
         Array of OriginRequestHeader objects  | 
       
         Definition Rewrite the HTTP headers in request URLs during CDN PoP origin pull. Constraints 
  | 
      
| 
         http_response_header  | 
       
         Array of HttpResponseHeader objects  | 
       
         Definition Headers returned by PoPs to clients. CDN includes them in responses to user requests for resources within that domain name. Constraints 
  | 
      
| 
         access_control  | 
       
         AccessControl object  | 
       
         Definition Access control. Constraints N/A  | 
      
| 
         request_limit_rules  | 
       
         RequestLimitRulesEngine object  | 
       
         Definition Request rate limiting. This limits the user request rate within a specific range to reduce costs and the risk of burst bandwidth. Constraints N/A  | 
      
| 
         origin_request_url_rewrite  | 
       
         Definition Origin request URL rewrite. Constraints Up to 20 rules.  | 
      |
| 
         cache_rule  | 
       
         CacheRulesEngine object  | 
       
         Definition Parameters used to control the cache TTL of origin server resources on CDN PoPs. Constraints N/A  | 
      
| 
         request_url_rewrite  | 
       
         RequestUrlRewriteEngine object  | 
       
         Definition Access URL rewrite rules, which are used to redirect user requests to the URLs of cached content. Constraints N/A  | 
      
| 
         browser_cache_rule  | 
       
         BrowserCacheRulesEngine object  | 
       
         Definition Browser cache TTL, during which users can obtain content directly from their browser cache (if available). Constraints N/A  | 
      
| 
         error_code_cache  | 
       
         ErrorCodeCacheEngine object  | 
       
         Definition You can cache error codes returned by the origin server on CDN PoPs. When users request the same resources, CDN directly returns the error codes to the users. Constraints N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         sources_type  | 
       
         String  | 
       
         Definition Origin server type. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         ip_or_domain  | 
       
         String  | 
       
         Definition IP address or domain name of the origin server. Constraints N/A Range N/A Default Value N/A  | 
      
| 
         obs_bucket_type  | 
       
         String  | 
       
         Definition OBS bucket type. Constraints Mandatory when the origin server is an OBS bucket. Range 
 Default Value public  | 
      
| 
         bucket_access_key  | 
       
         String  | 
       
         Definition Access key of the third-party bucket. Constraints Mandatory when the origin server is a third-party bucket. Range N/A Default Value N/A  | 
      
| 
         bucket_secret_key  | 
       
         String  | 
       
         Definition Secret key of the third-party bucket. Constraints Mandatory when the origin server is a third-party bucket. Range N/A Default Value N/A  | 
      
| 
         bucket_region  | 
       
         String  | 
       
         Definition Region of the third-party bucket. Constraints Mandatory when the origin server is a third-party bucket. Range N/A Default Value N/A  | 
      
| 
         bucket_name  | 
       
         String  | 
       
         Definition Name of the third-party bucket. Constraints Mandatory when the origin server is a third-party bucket. Range N/A Default Value N/A  | 
      
| 
         host_name  | 
       
         String  | 
       
         Definition Host header. Constraints N/A Range N/A Default Value Acceleration domain name.  | 
      
| 
         origin_protocol  | 
       
         String  | 
       
         Definition Request protocol for CDN origin pull. Constraints N/A Range 
 Default Value http  | 
      
| 
         http_port  | 
       
         Integer  | 
       
         Definition HTTP port. Constraints N/A Range 1 to 65,535. Default Value 80  | 
      
| 
         https_port  | 
       
         Integer  | 
       
         Definition HTTPS port. Constraints N/A Range 1 to 65,535. Default Value 443  | 
      
| 
         priority  | 
       
         Integer  | 
       
         Definition Priority. A larger value indicates a higher priority. Constraints N/A Range 1 to 100. Default Value N/A  | 
      
| 
         weight  | 
       
         Integer  | 
       
         Definition Weight. A larger value indicates that content is pulled from this origin server more frequently. If there are multiple origin servers with the same priority, the weight determines the proportion of content pulled from each origin server. Constraints N/A Range 1 to 100. Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         name  | 
       
         String  | 
       
         Definition Name of an origin request header. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         value  | 
       
         String  | 
       
         Definition Value of the origin request header. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         action  | 
       
         String  | 
       
         Definition Operation type of the origin request header. Constraints 
 Range 
 Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         name  | 
       
         String  | 
       
         Definition Name of an HTTP response header. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         value  | 
       
         String  | 
       
         Definition Value of the HTTP response header. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         action  | 
       
         String  | 
       
         Definition Operation type of the HTTP response header. Constraints 
 Range 
 Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         type  | 
       
         String  | 
       
         Definition Access control type. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         limit_rate_after  | 
       
         Long  | 
       
         Definition Rate limit condition. 
          NOTE: 
          
        
          For example, type=size,limit_rate_after=50 indicates that the speed is limited to the value of limit_rate_value after 50 bytes are transmitted.
          
        Constraints N/A Range 0 to 1,073,741,824, in bytes. Default Value N/A  | 
      
| 
         limit_rate_value  | 
       
         Integer  | 
       
         Definition Rate limit, that is, the maximum access speed after the rate limit is reached. Constraints N/A Range 0 to 104,857,600, in bit/s. Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         rewrite_type  | 
       
         String  | 
       
         Definition Rewrite method. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         source_url  | 
       
         String  | 
       
         Definition URI to rewrite. Constraints This parameter is mandatory when rewrite_type is set to wildcard or regex. When rewrite_type is set to regex, this parameter must start with ^/. Example: ^/test. Range 
 Default Value N/A  | 
      
| 
         target_url  | 
       
         String  | 
       
         Definition URI after rewrite. Constraints Range 
 
          NOTE: 
          
        
          The nth wildcard (*) field can be captured by $n, where n = 1, 2, 3, .... Example: /newtest/$1/$2.jpg.
          
        Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         ttl  | 
       
         Integer  | 
       
         Definition TTL of a resource cached on CDN PoPs. Constraints Up to 365 days. Range N/A Default Value N/A  | 
      
| 
         ttl_unit  | 
       
         String  | 
       
         Definition Unit of the cache TTL. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         follow_origin  | 
       
         String  | 
       
         Definition Source of the cache TTL, that is, whether CDN PoPs use the cache TTL set on the origin server or that set in cache rules on CDN. Constraints N/A Range 
 Default Value off  | 
      
| 
         force_cache  | 
       
         String  | 
       
         Definition Forcible cache. Specify whether CDN PoP cache ignores the no-cache, private, and no-store fields in the Cache-Control response header sent from the origin server. Constraints Forcible cache is used together with cache TTL source. For details about the restrictions and configuration effect, see section "PoP Cache Rules" in the User Guide of CDN. Range 
 Default Value off  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         redirect_status_code  | 
       
         Integer  | 
       
         Definition Redirection status code. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         redirect_url  | 
       
         String  | 
       
         Definition Redirection URL. Constraints 
 Range N/A Default Value N/A  | 
      
| 
         redirect_host  | 
       
         String  | 
       
         Definition Domain name to which client requests are redirected. Constraints N/A Range 
 Default Value Acceleration domain name.  | 
      
| 
         execution_mode  | 
       
         String  | 
       
         Definition Action. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         cache_type  | 
       
         String  | 
       
         Definition Cache effective type. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         ttl  | 
       
         Integer  | 
       
         Definition Cache TTL. Constraints 
 Range N/A Default Value N/A  | 
      
| 
         ttl_unit  | 
       
         String  | 
       
         Definition Unit of the cache TTL. Constraints Mandatory when the cache effective type is set to ttl. Range 
 Default Value N/A  | 
      
| 
         Parameter  | 
       
         Type  | 
       
         Description  | 
      
|---|---|---|
| 
         code  | 
       
         Integer  | 
       
         Definition Error codes to cache. Constraints N/A Range 
 Default Value N/A  | 
      
| 
         ttl  | 
       
         Integer  | 
       
         Definition Error code cache TTL. Constraints N/A Range 0 to 31,536,000, in seconds. 
          NOTE: 
          
        
          The cache TTL of 3XX status codes ranges from 0s to 20s.
          
        Default Value N/A  | 
      
Example Requests
GET https://cdn.myhuaweicloud.com/v1.0/cdn/configuration/domains/www.example.com/rules
Example Responses
Status code: 200
Request succeeded.
{
  "rules" : [ {
    "rule_id" : "example***********************id",
    "name" : "example",
    "status" : "on",
    "priority" : 1,
    "conditions" : {
      "match" : {
        "logic" : "and",
        "criteria" : [ {
          "match_target_type" : "scheme",
          "match_target_name" : "example",
          "match_type" : "contains",
          "match_pattern" : [ "HTTP" ],
          "negate" : false,
          "case_sensitive" : false
        } ]
      }
    }
  } ]
}
  Status Codes
| 
         Status Code  | 
       
         Description  | 
      
|---|---|
| 
         200  | 
       
         Request succeeded.  | 
      
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot