自定义域的记录与CNAME记录 [英] A record vs CNAME record for custom domain

查看:94
本文介绍了自定义域的记录与CNAME记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该选择哪个?为什么? Firebase建议使用CNAME记录,但是为什么呢? 指向IP地址,而不是指向另一个指向该IP地址的域,不是更好吗?

Which should I pick and why? Firebase recommends CNAME records but why? Isn't it better to point to the ip address rather than point to another domain that points to the ip address?

推荐答案

Firebase推荐CNAME记录,但是为什么?

Firebase recommends CNAME records but why?

Firebase托管可能CNAME记录标记为推荐记录,因为注册商广泛允许设置它们,并且大多数新手在设置通配符时最容易设置它们.

Firebase hosting is probably marking CNAME records as recommended because they are widely allowed for setup by registrars and the easiest to setup for most novices when setting up their wildcards.

指向IP地址,而不是指向另一个指向该IP地址的域,不是更好吗?

Isn't it better to point to the ip address rather than point to another domain that points to the ip address?

,您是正确的.这将是一个更快的查找,因为它不必进行2次查找(CNAME然后是指向的域名).

YES you are correct. It is going to be a faster lookup because it will not have to do 2 lookups (the CNAME then the pointed domain name).

Firebase托管使您可以选择在DNS中添加A记录,该记录不仅具有一个IP地址,而且还具有两个IP地址,以提高性能.

Firebase Hosting gives you the option to add A records in your DNS with not just one IP address but two for even better performance.

我应该选择哪个,为什么?

Which should I pick and why?

您将在这里选择.

  • 如果首先允许,则使用A记录指向IP地址,如果您不担心托管服务器的IP地址将更改. Firebase Hosting将来会更改IP地址吗?也许,但是可能不是很经常.
  • 如果您不担心进行两次查找,或者希望进行更简单的设置,请使用CNAME.
  • 如果您将多区域CDN用于带有google或Netlify之类的主机的静态站点,并且没有将其DNS服务器用于您的域,请使用CNAME.这样一来,他们的服务器就可以将用户解析为与其所在区域中距离最近的服务器.
  • Use A records pointing to IP addresses if allowed first if you are not concerned the IP address will change for the hosting server. Will Firebase Hosting change IP addresses in the future? Maybe, but probably not very often.
  • Use CNAME if you are not concerned about the lookup making two lookups or you want an easier setup.
  • Use CNAME if you are using a multi-region CDN for a static site with google or a host like Netlify and you are not using their DNS servers for your domain. This will allow their servers to resolve users to the closest server in their region.

注意::如果Firebase Hosting决定对托管服务进行domain nameIP Address更改,则这两个选项都可能需要更改,但我怀疑它们会提前通知您时间就要发生了.

NOTE: Both of these options could require a change if Firebase Hosting decides to make a domain name or IP Address change to their hosting services, but I would suspect they would notify you ahead of time as soon as that is going to happen.

在这种情况下,我的选择是使用A记录指针,因为我们在这里与Google进行交易,并且通常对更改通知很有用.我可以在DNS配置中像在域名中一样快速更改IP地址.

My choice is to use A record pointers in this case because we are dealing with Google here and typically are good about notifications of changes. I can change an IP address as quickly as a domain name in a DNS configuration.

这篇关于自定义域的记录与CNAME记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆