All Products
Search
Document Center

CDN:Configure a conditional origin

更新時間:Oct 10, 2024

The conditional origin feature can be used with the rules engine feature to filter user requests based on specified conditions, such as request header, query string parameter, path, and client ip. Requests that meet the conditions are redirected to the specified origin server. You can add multiple rules so that requests can be redirected to different origin servers based on the rules.

Prerequisites

A rule is created in the rules engine before you configure a conditional origin. For more information, see Rules engine.

Usage notes

  • Feature conflict: The conditional origin feature conflicts with the Configure advanced origin settings feature. You can use only one of the two features.

  • Matching order: The system attempts to match rules in the configuration list in descending order. If a rule is matched, the system stops the matching.

  • Interaction with the rules engine: Before you configure a conditional origin, you must configure an associated rule.

  • If the origin server is an Object Storage Service (OSS) bucket, click Basics in the left-side navigation tree of the domain name, click Modify in the Origin Information section, and set the Origin Info parameter to OSS Domain. This way, Alibaba Cloud CDN can authenticate requests to the OSS bucket.

Differences between the conditional origin, basic origin, and advanced origin

  • The address of a basic origin is the default address of the origin server used for origin fetch. If a user request does not match the rule of a conditional origin or advanced origin, the address of the basic origin is used.

  • If a user request matches the rule of a conditional origin or advanced origin, the address of the origin server that is specified in the conditional origin or advanced origin settings is used.

  • The conditional origin feature is an enhanced version of the advanced origin feature. The conditional origin feature can use rules configured in the rules engine. This allows you to configure more flexible origin policies.

Procedure

  1. Log on to the Alibaba Cloud CDN 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 Manage in the Actions column.

  4. In the Origin Information section, click Expand next to Conditional Origin.

  5. Click Add Conditional Origin.

  6. Configure the Rule Condition parameter.

    • The first time you add a rule or modify an existing rule, you can click Rules Engine in the Conditional Origin dialog box, and add or modify the rule on the page displayed. For more information, see Rules engine.规则引擎

    • If rules already exist, you can select one from the Rule Condition drop-down list.

  7. In the Origin Address field, enter the address of the origin server, such as an origin IP address, an origin domain, the domain name of an OSS bucket, or a Function Compute domain name.

  8. Click OK.