X-DNS-Prefetch-Control

Speculative DNS resolution for links on a page is controlled by the unofficial X-DNS-Prefetch-Control response header, which enables or disables browser DNS prefetching.

Usage

DNS prefetching is a browser optimization where the browser resolves domain names for hyperlinks on a page before the user clicks them. Each DNS lookup adds latency, often tens of milliseconds, and prefetching eliminates this delay by completing the resolution in advance.

The X-DNS-Prefetch-Control header gives site operators explicit control over this behavior. Pages with many external links benefit from prefetching because the resolved addresses are ready when the user navigates. Pages handling sensitive information disable prefetching to prevent DNS queries from leaking the domains referenced on the page, as each prefetch sends a DNS query visible to network observers and DNS resolvers.

Chromium-based browsers and Firefox honor the header. Both enable DNS prefetching by default for pages loaded over HTTP and disable prefetching for pages loaded over HTTPS. The header overrides the default in either direction. Child frames inherit an opt-out from the parent document, so a frame cannot re-enable prefetching a parent page switched off.

The header governs the implicit prefetch of hostnames found in links. Explicit <link rel="dns-prefetch"> hints resolve regardless of the header, because the browser gates those hints on its own prefetch setting rather than on the page flag. A page sending off still warms the hosts it names in dns-prefetch hints, which keeps per-host control available while blocking the blanket resolution of every linked domain.

The same control is available as a meta tag, <meta http-equiv="x-dns-prefetch-control" content="off">, for pages whose server headers cannot be changed. The Helmet middleware for Node.js sends X-DNS-Prefetch-Control: off by default, which is the usual reason the header appears on Express applications.

Values

on

The on value enables DNS prefetching for all links on the page. Browsers resolve the domain names of linked resources in the background as the page loads.

off

The off value stops the browser from resolving the hostnames found in links on the page. Explicit <link rel="dns-prefetch"> hints still run. The value suits privacy-sensitive pages, login forms, or pages listing user-specific content where the linked domains reveal information about the page contents.

Any value other than on disables prefetching, and the decision sticks for the lifetime of the document. Once a page has turned prefetching off, a later on from a meta tag is ignored.

Example

Enabling DNS prefetching on a page with many external links to improve perceived navigation speed:

X-DNS-Prefetch-Control: on

Disabling DNS prefetching on a page handling sensitive data, preventing DNS queries from revealing linked domains:

X-DNS-Prefetch-Control: off

See also

Last updated: November 3, 2026