CDN supports wildcard domain name acceleration. Learn what wildcard domain names are and how to add one.
What is wildcard domain name acceleration?
A wildcard domain name accelerates all matching subdomains. For example,.aliyundoc.com is a wildcard domain name. example.aliyundoc.com is a second-level domain name of .aliyundoc.com, and image.developer.aliyundoc.com is a third-level domain name of .aliyundoc.com.
For example, you can add .aliyundoc.com as an accelerated domain name. After you map .aliyundoc.com to the CDN-generated CNAME, all second-level domain names such as example.aliyundoc.com and demo.aliyundoc.com resolve to the CNAME of .aliyundoc.com.
-
A root-level wildcard accelerates only second-level domain names. For example, if you add
.aliyundoc.com, thenexample.aliyundoc.comis accelerated, but the third-levelimage.developer.aliyundoc.comis not. If a request forimage.developer.aliyundoc.comreaches a point of presence (POP), the POP rejects it and returns a 403 status code. -
CDN treats suffixes such as .com.cn, .net.cn, .gov.cn, .edu.cn, and .org.cn as top-level domains (complete list). For example,
.aliyundoc.com.cnis a wildcard domain name whereexample.aliyundoc.com.cnis second-level andimage.developer.aliyundoc.com.cnis third-level. -
Purge and prefetch do not support wildcard domain URLs or directories. Use exact domain names instead. For example,
http://.aliyundoc.com/example/b.mp4cannot be purged, buthttp://example.aliyundoc.com/example/b.mp4can.
Rules for adding wildcard domain names
Note the following rules when you add a wildcard domain name to CDN:
-
The total length of the domain name (for example,
image.example.com) cannot exceed 100 characters. -
The part of the domain name that precedes the root domain cannot exceed 64 characters. For example, for the domain name
image.example.com, the part that precedes the root domainexample.comisimage. -
A wildcard domain name uses either format:
.aliyundoc.comor*.aliyundoc.com. Both are equivalent. The CDN console displays the name as.aliyundoc.com. -
CDN supports multi-level wildcard domain names, such as *.example.aliyundoc.com, *.image.example.aliyundoc.com, and *.cat.image.example.aliyundoc.com.
-
Matched domain names incur data transfer fees the same way as specific domain names. Their data usage is aggregated on the Resource Monitoring page of the CDN console. CDN treats each wildcard as an individual accelerated domain name and reports billing per wildcard, not per matched domain.
Wildcard domain name logs
CDN generates one log file per wildcard domain name at each time interval, covering all matched domain names. Overview.
Add a wildcard domain name
-
Log on to the Alibaba Cloud CDN console.
-
Add a wildcard domain name to CDN. Add a domain name.