Skip to content
The <head> Observatory

/static/observatorio/en/astro/dns-prefetch/

Menu

HED-002 · Connections

<link rel="dns-prefetch">

Only the first leg of the trip: it resolves the server's name and stops there.

The cheapest hint in the drawer: it asks only for the DNS resolution of the origin, without opening any connection. It sounds like little, but a name lookup can cost tens or hundreds of milliseconds on a mobile network — paid before the resource is ever requested.

It lives in two roles: as the backup of preconnect, on the next line, for browsers that don't understand it; and alone, when there are too many origins to preconnect to all of them — resolving names is cheap, keeping connections open is not.

<link rel="dns-prefetch" href="https://cdn.exemplo.org">
The name resolved before the request exists.