我在我的域名中定义了一组子域名,如下所示:
CNAME sub1.example.com -> sub1.herokuapp.com
CNAME sub2.example.com -> sub2.appspot.com
CNAME www.example.com -> example.herokuapp.com
现在我想添加CNAME *.example.com -> example.herokuapp.com
来捕获那些输入太多WWW或输入其他缺失子域的人。但*
优先于明确定义的子域,或者子域是否会按预期继续工作?
如果它有所作为,我正在使用Route53。
答案 0 :(得分:46)
通配符只会匹配区域中未另行定义的记录。
请参阅RFC 1912,它会在此处提及MX
条记录,但这同样适用于CNAME
:
2.7 Wildcard records
Wildcard MXs are useful mostly for non IP-connected sites. A common
mistake is thinking that a wildcard MX for a zone will apply to all
hosts in the zone. A wildcard MX will apply only to names in the
zone which aren't listed in the DNS at all. e.g.,
podunk.xx. IN NS ns1
IN NS ns2
mary IN A 1.2.3.4
*.podunk.xx. IN MX 5 sue
Mail for mary.podunk.xx will be sent to itself for delivery. Only
mail for jane.podunk.xx or any hosts you don't see above will be sent
to the MX. For most Internet sites, wildcard MX records are not
useful. You need to put explicit MX records on every host.
答案 1 :(得分:7)
不可以,定义的子域应该优先于通配符。