[英]DNS prefetching of subdomains
我是否必须单独预取子域?
例如,当我有<link rel="dns-prefetch" href="//example.com">
我是否还需要//static.example.com
的附加标签?
我做了以下测试:首先创建了简单的HTML页面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="dns-prefetch" href="//example.com/">
</head>
<body>
<a href="http://example.com">Test link</a>
<a href="http://sub.example.com">Test link 2</a>
</body>
</html>
对于我拥有dns名称服务器的域和子域。 然后我清理了dns缓存并在firefox私有窗口中打开了这个页面。 我在我的dns名称服务器的日志中观察到,只发出了对“example.com”的请求,并且没有子域请求。
然后我按如下方式更改了页面:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="dns-prefetch" href="//example.com/">
<link rel="dns-prefetch" href="//sub.example.com/">
</head>
<body>
<a href="http://example.com">Test link</a>
<a href="http://sub.example.com">Test link 2</a>
</body>
</html>
再次清除dns缓存并在firefox私有窗口中打开此页面。 现在我观察到dns请求我们为域和它的子域做了。
所以我可以得出结论是 - 你必须单独预取子域名。
您必须单独预取每个子域。
这是DNS的工作方式。 你问名字,它回答,它对“子域名”一无所知它只是一个名字。
nslookup google.com
仅为nslookup google.com
提供答案,没有子域名。
nslookup www.google.com
仅提供www.google.com,不提供顶级域名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.