X-DNS-Prefetch-Control Header

Table of Content

  • Syntax
  • Directives
  • Examples
  • Browser Compatibility
  • How to modify X-DNS-Prefetch-Control header The X-DNS-Prefetch-Control HTTP header is a security header that controls DNS prefetch, a feature that enables browsers to proactively perform domain name resolution on both links that the user might choose to follow as well as URLs for items referenced by the document. This helps in reducing latency in certain situations. It's an implementation of the DNS prefetching or pre-resolve feature.

Syntax

The syntax for the X-DNS-Prefetch-Control HTTP header is simply:

X-DNS-Prefetch-Control: on/off

Directives

For the X-DNS-Prefetch-Control header, there are two directives:

  • on: DNS prefetching is allowed.
  • off: DNS prefetching is not allowed.

Examples

Here's a simple usage of the X-DNS-Prefetch-Control header:

X-DNS-Prefetch-Control: on

This allows prefetching of DNS for links and URLs in the document.

If you don't want prefetching, just put off instead:

X-DNS-Prefetch-Control: off

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Not Supported
Opera Supported
Edge Supported

(Note: The compatibility can change from time to time, always refer back to updated documentation for precise information).

How to modify X-DNS-Prefetch-Control header

ModHeader is a Chrome extension that allows you to modify your HTTP request and response headers. To modify the X-DNS-Prefetch-Control header:

  1. Install the ModHeader plugin from the Chrome web store.
  2. Click on the ModHeader icon on your browser’s toolbar.
  3. Enter "X-DNS-Prefetch-Control" under 'Response headers'.
  4. Put either 'on' or 'off' in the next field to the right.
  5. Now your header is modified and you can browse with the new settings.

The ModHeader tool is especially useful for developers and testers who need to change the headers often for testing or debugging purposes.