DCDN rules engine

Updated at:

Use the rules engine's graphical interface to define conditional rules based on request parameters and control exactly when DCDN configuration policies take effect.

Note

Note: When this feature references rule conditions from the Rules Engine, the execution order follows the priority order of the rule conditions configured in the Rules Engine, NOT the priority order of this feature's own configuration.

Background

The Alibaba Cloud DCDN console provides basic features such as configuring time-to-live (TTL) and rewriting back-to-origin parameters. These features cover most use cases but cannot handle all requirements. For example, you might need to route requests containing the path /example to a specific origin. For such scenarios, combine basic features with the rules engine for more flexible configurations. Alibaba Cloud DCDN also offers EdgeRoutine for advanced customization.

Configuration capability

Basic features

Basic features + rules engine

EdgeRoutine

Implementation

General-purpose configurations

Flexible custom configurations

Highly flexible custom configurations

Scenarios

Common use cases

Advanced custom requirements

Fully customized requirements

Difficulty

Low

Medium

High

Configuration flexibility

Low

Medium

High

Limitations

  • You can create a maximum of 50 rule conditions per domain name.

  • Each rule condition can contain a maximum of 20 sub-rules.

  • You cannot use regular expression match or regular expression mismatch operators when configuring rule conditions in the console or using OpenAPI. However, you can view existing configurations that use these operators. To use these operators, use ESA.

  • A rule condition can be referenced a maximum of five times across all features within a single domain name.

  • You can nest rule conditions up to three levels deep, and each level can have its own independent logical relationships.

  • If a feature, such as setting the cache expiration time or modifying outgoing request headers, references a rule condition, the condition's priority determines the execution order, not the feature's configuration order.

  • Among the preceding limits, the maximums of 50 rule conditions, 20 sub-rules, and 3 levels of nesting are hard limits that cannot be increased upon request. The maximum total number of references to rule conditions across all features within a single accelerated domain name, which is 5 by default, can be increased upon request.

    • To increase the total number of times that rule conditions can be referenced for a single domain name (five by default), submit a ticket. Provide the following information in the ticket: the accelerated domain name for which you want to increase the limit, the target number of references, and a description of your business scenario.

    • When adding another accelerated domain name, submit a separate ticket to increase the number of rule-condition references for that domain. The process is the same as for the first request.

  • Each condition can have a maximum of 32 match values for match types such as client IP, URI, file extension, filename, and User-Agent. If you have a large client IP allowlist, consolidate multiple IP addresses into CIDR blocks (for example, 120.209.XXX.X/24) to configure the IP addresses and conserve match-value capacity.

  • You can configure a maximum of 32 User-Agent match values. Values beyond this limit are ignored. To match a large number of User-Agents, use a wildcard (*) to consolidate similar User-Agent values. For example, *Chrome* matches all Chrome browser versions), or use EdgeScript for more flexible matching logic.

Rule condition syntax

A rule condition combines one or more conditional expressions by using logical operators. The following sections describe the syntax.

Logical operators

Logical operators evaluate conditions at the same level, including nested condition sets. The supported operators are and and or.

  • and (AND): A logical AND operator. A match succeeds only if all conditions are true.

  • or (OR): A logical OR operator. A match succeeds if any condition is true. For example, configuring multiple rule conditions for the same response header lets you add the same response header under different conditions. Example: When the URI contains /path-a or the URI contains /path-b , add the response header.

Parameters of a conditional expression

A conditional expression, the most granular unit of a rule, includes the following parameters:

Parameter

Corresponding configuration parameter in the condition function for domain name configuration

Description

Required

Conditional match

match

Specifies the conditional match expression.

Yes

Logical operator

logic

Specifies the logical operator for the conditional match expression. Valid values are and and or.

Yes

Criteria

criteria

Specifies the array of conditional expressions to be evaluated.

Yes

Match type

MatchType

Specifies the type of information in a client request to match.

Yes

Match object

MatchObject

Further refines the match type. For example, a client IP address can be specified as a POP connection IP or an XFF IP.

No

Match operator

MatchOperator

Specifies the comparison to perform.

Yes

Match value

MatchValue

The value to compare against data from the client request.

Yes

Negate condition

negate

Specifies whether to negate the result of the conditional expression. Valid values are true and false.

Yes

Case sensitivity

caseSensitive

Specifies whether the match value is case-sensitive.

No

Rule condition name

name

Specifies the name of the rule condition.

Yes

Status

status

Specifies the status of the rule condition.

Yes

Features supporting rule conditions

Feature category

Feature name

origin fetch configuration

Specify the origin host

Modify incoming request headers

origin HTTP request headers (New)

origin HTTP response headers

cache configuration

Configure time-to-live

Modify outgoing response headers

custom cache key

Procedure

  1. Log on to the DCDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name that you want to manage and click Configure in the Actions column.

  4. In the left navigation pane, click Rule Engine.

  5. Click Create Rule.

  6. On the Create Rule page, set the Rule Name and Rule Content.

  7. Click Submit.