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

Before you configure a conditional origin, you must create a rule in the rules engine. 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.

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 back-to-origin routing. 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 back-to-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.
    Domain Names
  4. In the Origin Information section, click Expand next to Conditional Origin.
  5. Click Add Conditional Origin.
  6. Configure Rule Condition.
    • If you add a rule for the first time or modify an existing rule, you can click Rules Engine in the Conditional Origin dialog box, and add or modify the rule on the Rules Engine page. For more information, see Rules engine. 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.