Basic settings FAQ

Updated at:

This topic answers frequently asked questions about two basic Alibaba Cloud CDN configuration topics: wildcard domain name acceleration and conditional origins. Conditional origins select an origin based on rule conditions, with the basic origin as the fallback. The answers cover origin selection and effective time for conditional origins, how conditional origins work with hotlink protection, and how to troubleshoot 502 errors when CDN fetches content from Global Accelerator (GA) through conditional origins.

Domain and origin configuration

The following questions address configuration boundaries, effective time, and cache handling for wildcard domain name acceleration and conditional origins.

Does CDN support wildcard domain name acceleration?

Yes. Wildcard domain name acceleration uses a wildcard as an accelerated domain name to accelerate multiple subdomains at the same level. After you add *.example.com, both a.example.com and b.example.com can use Alibaba Cloud CDN acceleration.

The procedure for adding a wildcard domain name is the same as the procedure for adding a standard accelerated domain name. For more information, see Add an accelerated domain name.

Limitations

  • When you add a wildcard domain name, .example.com and *.example.com have the same effect. After you add the domain name, the console displays it as .example.com.

  • A wildcard domain name matches only subdomains at the same level. For example, *.example.com does not match the root domain example.com or deeper subdomains such as x.a.example.com(a 403 error code will be returned in these cases). To accelerate these domain names, add the root domain or a wildcard domain name at the corresponding level, such as *.a.example.com.

  • If a request matches both an exact domain name and a wildcard domain name, the configuration of the exact domain name takes precedence over the configuration of the wildcard domain name. For example, if you add both a.example.com and *.example.com, requests to a.example.com are processed based on the configuration of a.example.com.

  • For complete requirements on account ownership and quantity limits for wildcard and exact domain names, see Limits.

    When you configure a CNAME for a wildcard domain name, use the CNAME address that the console assigns to that wildcard domain name. For the rules on how wildcard domain name resolution is inherited by subdomains and its priority, see How wildcard domain name CNAME resolution affects subdomains.

Billing and logs

  • Traffic for all subdomains under a wildcard domain name is aggregated for that wildcard domain name. Separate billing data is not provided for individual subdomains.

  • One log file is generated for each wildcard domain name in each period. The file contains access logs for all subdomains under that wildcard domain name.

Do I need to add matching URL paths on the origin when I configure a conditional origin?

No. You do not need to configure additional URI matching rules on the origin for a conditional origin. A conditional origin is an origin that Alibaba Cloud CDN selects for a request when the request matches the rule conditions that the conditional origin references. When no rule matches, CDN falls back to the basic origin if one is configured. CDN selects an origin based on whether a request matches rule conditions and sends the URL path in the request to the selected origin. The origin must be able to respond to resources at the corresponding path.

  • When a request matches the rule condition that a conditional origin references, CDN fetches content from the origin associated with that rule.

  • When a request does not match any conditional origin rule and a basic origin is configured, CDN fetches content from the basic origin.

    The rules, origin addresses, and specified origin Host for conditional origins are all configured in Alibaba Cloud CDN. For more information, see Configure a conditional origin.

When you configure conditional origins, note the following limits. Otherwise, the configuration or origin authentication may fail:

  • Conditional origins and Advanced origin are mutually exclusive. You can configure only one of them for a domain name.

  • For a single domain name, rule conditions can be referenced a maximum of five times in total by all features, including conditional origins, advanced origin, and Referer-based hotlink protection. If this limit is exceeded, the configuration fails.

  • If a conditional origin points to an OSS address, you must first add the OSS address to the origin information of the domain name and set the origin type to OSS Domain. Otherwise, Alibaba Cloud CDN cannot authenticate with OSS.

  • If you configure multiple OSS origins, you must configure a Specify an origin-pull HOST for an origin server for each origin, and the origin Host must be the same as the domain name of the corresponding OSS bucket. Otherwise, requests may be sent to the wrong bucket during origin fetch, and a 403 SignatureDoesNotMatch or 404 Not Found error is returned. The specified origin Host takes precedence over the default origin Host. You do not need to disable the default origin Host.

How long does a conditional origin configuration take to become effective, and do I need to refresh the cache?

Propagation time: After you modify a conditional origin configuration, the change typically takes effect globally within 5 to 10 minutes. The configuration is gradually distributed to edge nodes, and old and new configurations may coexist during this period.

Cache refresh: If you modify only origin fetch rules and do not need to immediately verify cached resources, you usually do not need to refresh the cache. If edge nodes have cached content returned by the old origin, or you need to immediately verify the new rule, refresh the test URL so that the next request fetches content from the new origin according to the new rule. For more information about refreshing the cache, see Refresh and prefetch resources.

After the configuration is distributed, use curl -I to request URLs that match and do not match the rule conditions. Check the responses to verify that requests fetch content from the expected origins.

Using conditional origins with other features

The following questions describe how conditional origins work with GA.

How do I troubleshoot 502 errors when CDN uses conditional origins to fetch content from GA?

When CDN uses a conditional origin to perform origin fetches for some requests from GA, a 502 error usually points to the origin Host, protocol, or port. If a 502 error occurs, check the origin Host, protocol, and port for each traffic branch:

  1. Check the origin Host. Configure a specified origin Host for each conditional origin. The specified origin Host takes precedence over the default origin Host. Set the specified origin Host for each traffic branch:

    • Traffic from the Chinese mainland that fetches content from a server IP address in the Chinese mainland: set the specified origin Host to the CDN accelerated domain name.

    • Traffic from outside the Chinese mainland that fetches content from a GA origin domain: set the specified origin Host to the GA origin domain.

  2. Check the protocol and port. Make sure that the GA listener protocol and port are consistent with the Alibaba Cloud CDN origin protocol policy and port.

    GA listener

    Origin support

    CDN origin fetch

    HTTPS port 443

    HTTPS supported

    HTTPS port 443

    HTTP port 80

    HTTPS not supported

    HTTP port 80

    For steps about GA health check and configurations, see How do I troubleshoot 502 errors after I configure GA?.

  3. If the origin Host, protocol, and port are consistent but a 502 error still occurs, see Troubleshooting guide about origin fetch to continue checking origin reachability and the origin fetch path.