【问题标题】:Does the * in a CNAME record take priority over explicit subdomains?CNAME 记录中的 * 是否优先于显式子域?
【发布时间】:2013-01-23 07:52:10
【问题描述】:

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

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。

【问题讨论】:

    标签: dns cname amazon-route53


    【解决方案1】:

    不,它没有,定义的子域应该优先于通配符。

    【讨论】:

      【解决方案2】:

      通配符将仅匹配区域中未以其他方式定义的记录。

      参见RFC 1912,这里提到了MX 记录,但同样适用于CNAMEs:

      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.
      

      【讨论】:

      • 嗯,是的。 RFC 引用是 SO 的参数提供者。
      猜你喜欢
      • 2018-04-23
      • 2019-07-19
      • 1970-01-01
      • 2022-01-06
      • 1970-01-01
      • 2018-10-16
      • 2020-12-15
      • 2022-01-17
      • 2017-09-14
      相关资源
      最近更新 更多