如果主网站DNS管理器不是Route 53,则将ALIAS用于ELB [英] Using ALIAS for ELB if main website DNS manager is not Route 53
问题描述
我使用 Netlify 托管我的静态站点example.com
.由于我不想附加www
,因此必须使用Netlify的DNS名称服务器.
I use Netlify to host my static site example.com
. Since I don't want to append www
, I have to use Netlify's DNS nameservers.
example.com
使用API后端api.example.com
,这是一个CNAME
记录,可解析为 ELB 地址*.elb.amazonaws.com
.
example.com
uses API backend api.example.com
, which is a CNAME
record that resolves to an ELB address *.elb.amazonaws.com
.
因此需要2个DNS查找:首先到example.com
,然后到*.elb.amazonaws.com
.
So 2 DNS lookup is required: first to example.com
then to *.elb.amazonaws.com
.
替代:
使用另一个具有ALIAS
记录api.example.org
指向*.elb.amazonaws.com
的自定义域example.org
设置Route 53,并为example.com
的API端点使用api.example.org
而不是api.example.com
查找example.com
和api.example.org
.
Alternative:
Setup Route 53 with another custom domain example.org
with an ALIAS
record api.example.org
that points to *.elb.amazonaws.com
, and use api.example.org
instead of api.example.com
for example.com
's API endpoints, then it'd have to look up example.com
and api.example.org
.
选择替代方案是否有性能优势?它们是否会相似,因为唯一的区别是必须查找api.example.org
而不是*.elb.amazonaws.com
?
Is there any performance advantage advantage choosing the alternative? Would they be similar since the only difference is it has to lookup api.example.org
instead of *.elb.amazonaws.com
?
推荐答案
别名记录优于CNAME记录,因为它们在解析后直接返回IP地址.
Alias records are better than CNAME records, because they return an IP address directly upon resolution.
示例1:
api.example.com
作为*.elb.amazonaws.com
您的浏览器将首先解析example.com
,下载HTML代码,然后在执行页面时,需要解析api.example.com
.执行此操作时,它将:
Your browser will resolve example.com
first, download the HTML code, then upon execution of the page, it will need to resolve api.example.com
. When it does this, it will:
- 接收CNAME结果,然后
- 需要解决
*.elb.amazonaws.com
因此,在上面,总共需要3种分辨率.
So in the above, there are a total of 3 resolutions required.
示例2:
api.example.org
作为*.elb.amazonaws.com
您的浏览器将首先解析example.com
,下载HTML代码,然后在执行页面时,将需要解析api.example.org
.执行此操作时,它将:
Your browser will resolve example.com
first, download the HTML code, then upon execution of the page, it will need to resolve api.example.org
. When it does this, it will:
- 直接接收A结果(IP地址)
因此,在上面,总共需要2种分辨率.
So in the above, there are a total of 2 resolutions required.
这篇关于如果主网站DNS管理器不是Route 53,则将ALIAS用于ELB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!