2013-02-07 46 views
22

我有一組這樣對我的定義域的子域:CNAME記錄中的*是否優先於顯式子域名?

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捉放太多WWWs或類型的其他子域失蹤誰鄉親。但*將優先於明確定義的子域名,還是子域名將繼續按預期工作?

我使用Route53,如果它有所作爲。

回答

43

通配符只會匹配沒有在區域中定義的記錄。

RFC 1912,它提到MX記錄在這裏,但同樣適用於CNAME S:

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. 
+2

+1引用RFC。 – johankj

+3

嗯,是的。 RFC引用是SO的參數引用。 –

7

不,沒有定義的子域應該優先於通配符。