CNAME记录中的*优先于明确的子域吗?

27

我在我的域名上定义了一组子域名,如下:

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是否有所不同。

2个回答

51
通配符只匹配在区域中没有其他定义的记录。
参见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.

3
好的。RFC 参考文献是 Stack Overflow 的论据终结者。 - Sudhir Jonathan

7
不会的,定义了子域名应该优先于通配符。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接