Skip to content

Comment on Saved 10 billion DNS queries per month by disabling DNS Prefetchingparent

Comments

I prefer HTTP headers instead of meta tags where possible.

An example solution at the load balancer level, assuming the use of Varnish:

In vcl_fetch:

  if (req.url ~ "\.(htm|html|php)" || req.url ~ "\/(\?.*)?$") {
    set beresp.http.disable-dns-prefetch = "1";
  }
In vcl_deliver:
  if (resp.http.disable-dns-prefetch) {
    remove resp.http.disable-dns-prefetch;
    set resp.http.X-DNS-Prefetch-Control = "off";
  }

do all the browsers that support the meta tag support consuming http headers for this "switch"?

Http-equiv is just a way of specifying an HTTP header in your HTML, so they really should.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.