Advanced origin

Updated at:

The advanced origin feature allows you to route client requests to different origins based on parameters such as the request header, query string parameter, path, or request cookie.

Usage notes

  • Rule limit: You can create a maximum of 120 rules.

  • Feature conflict: The conditional origin and advanced origin features are mutually exclusive. You can enable only one of them at a time.

  • Matching order: Rules are evaluated in the order they are listed. Processing stops after the first matching rule is found.

  • Port number: The advanced origin feature supports only domain name origins. You cannot specify a port number. To specify a port number for an origin domain name, or to configure an IP origin, OSS origin, or Function Compute origin, use conditional origin instead.

  • Path matching: Path matching in advanced origin supports only exact match. Wildcards and regular expressions are not supported. To route requests based on a path wildcard, such as /api/*, use conditional origin in combination with the rules engine.

Origin type comparison

Both conditional origins and advanced origins can reference Rule Conditions from the rules engine to create flexible origin routing policies. CDN automatically selects an origin if a request matches a Rule Condition:

Origin type

Trigger condition

conditional origin

The request matches the Rule Condition referenced by the conditional origin.

advanced origin

The request matches the Rule Condition referenced by the advanced origin.

basic origin

The request does not match any conditional origin or advanced origin rule (default fallback).

Primary/secondary origin failover: After a request matches an advanced or conditional origin rule, CDN performs an origin fetch directly from the origin specified by that rule. The priority and weight settings of basic origins no longer apply. For primary/secondary origin failover, configure the priority and weight settings of basic origins, rather than a conditional origin rule targeting one origin.

Procedure

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > CDN Configuration > Domain Names.

  3. On the Domain Names page, find your domain name and click Configure in the Actions column.

  4. In the left-side navigation pane, click Back-to-Origin.

  5. On the Configuration tab, in the Advanced Origin section, click Add.

  6. Configure the conditions and the Origin Domain Name.

    Note

    You can configure different origins based on the request header, query string parameter, path, or request cookie. When a point of presence (POP) receives a client request, it reads the corresponding field in the request, evaluates the match, and routes the request to the appropriate origin.

  7. Click OK.

Configuration example

This example shows how to route requests containing the parameter test=1 to the origin. In the Advanced Origin dialog box, set Criteria to Query String Parameter. Set the parameter name to test, the condition to Equal To, and the value to 1. Then, set the Origin Domain Name to img.yourdomain1.com and click OK.