e...">

Prefetching DNS Subdomains

Do I need to preselect a subdomain separately?

eg. when do i need an <link rel="dns-prefetch" href="//example.com"> extra tag for //static.example.com ?

+8
performance html prefetch dns
source share
2 answers

I did the following test: first created a simple html page

 <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> 

For the domain and subdomain for which I own a DNS name server. Then I cleared the DNS cache and opened this page in a private firefox window. I observed in the logs of my DNS server that only a request was sent to example.com and there were no requests for subdomains.

Then I changed the page as follows:

 <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> 

Cleared the DNS cache again and opened this page in a private firefox window. Now I noticed that the DNS queries we made for the domain and its subdomain.

So, I can conclude that yes - you need to preselect subdomains separately.

+10
source share

You must preselect each subdomain separately.

This is how DNS works. You ask for a name, it answers, it does not know anything about "subdomains", it's just a name.

nslookup google.com provides answers only on google.com, without subdomains.

nslookup www.google.com only provides www.google.com, not top-level domains.

+5
source share

All Articles