Skip to content

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

Comments

I'm surprised the article doesn't actually tell you the meta http-equiv to disable DNS prefetching. It mentions that it helped out tremendously, though. Here it is:

<meta http-equiv="x-dns-prefetch-control" content="off" />

or, if you're more into HTML5:

<meta http-equiv="x-dns-prefetch-control" content="off">

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.

Not closing the tag is nothing specific to HTML5, it just means you aren't strict on XHTML. HTML4 and others would be the same.

Well sure, but why does that matter? I could have said "or if you're more into HTML 4.01, 5, and anything before those versions of HTML..."

Pedantic.

I suppose it's just the irritation from the term HTML5 being used in all sorts of inaccurate or misleading ways. What you said wasn't inaccurate, but I feel like throwing in the term HTML5 was unnecessary. But yeah, it's pedantic. It's mostly me being irritated by others.

AboutSource Built by g1lg1l

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