Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enable DNS pre-resolution and TCP pre-connection

How can I enable DNS pre-resolution and TCP pre-connection in a Chrome browser (Mac OS X), when the chrome://dns page tells that "DNS pre-resolution and TCP pre-connection is disabled"?

enter image description here

like image 387
wintermeyer Avatar asked Sep 25 '14 09:09

wintermeyer


People also ask

What is DNS-prefetch and Preconnect?

dns-prefetch : indicates to the browser that it should perform the resolution of a given domain name (determining the IP to contact) before that domain is used to download resources. preconnect : indicates to the browser that it should connect a given origin, before that domain is used to download resources.

What is DNS pre?

Prefetching, also known as DNS prefetching, is the act of resolving a website's IP address before a user clicks on its link.

What is the use of DNS-prefetch?

DNS-prefetch is an attempt to resolve domain names before resources get requested. This could be a file loaded later or link target a user tries to follow.

What is Preconnect?

What is a preconnect? A preconnect is a resource hint that tells the browser to make a proactive HTTP connection to a domain the browser has not yet determined needs to be made. Creating an HTTP connection takes many steps, including: Making a DNS lookup. Connecting a TCP.


2 Answers

It's in the advanced settings and called "Predict network actions to improve page load performance"

Screenshot

like image 54
wintermeyer Avatar answered Sep 19 '22 06:09

wintermeyer


FWIW I had the behavior as in Q&A above in Chrome on Windows:

  • chrome://dns says "DNS pre-resolution and TCP pre-connection is disabled.",

whereas

  • chrome://settings shows "Use a prediction service to load pages more quickly" as ticked

I was wondering how this relates to <link rel="dns-prefetch" href="//some.domain"> and <link rel="preconnect" href="https://some.domain">.

Browsers:

  • Chrome 67 stable with uBlock
  • Chrome 68 beta (no extensions)

Before the tests

  • have chrome://dns tell you that the services are disabled (perhaps by installing uBlock)
  • serve the following HTMLs on localhost

    <!doctype html><html><head>
        <link rel="dns-prefetch" href="//ajax.googleapis.com">
    </head><body></html>
    
    <!doctype html><html><head>
        <link rel="preconnect" href="https://ajax.googleapis.com">
    </head><body></html>
    

Test 1: with Fiddler

  • go to chrome://net-internals/#dns and clear host cache
  • enable Fiddler and make it listen to the traffic
  • open new tab in Chrome on http://localhost
  • observe Fiddler to have a "Tunnel to ajax.googleapis.com:443" session

Test 2: without Fiddler

  • go to chrome://net-internals/#dns and clear host cache
  • open new tab in Chrome on http://localhost
  • refresh chrome://net-internals/#dns and observe DNS entries

Results and conclusions:

  • Chrome 67 stable with uBlock: preload always works; dns-prefetch is blocked by uBlock if uBlock setting Disable pre-fetching (to prevent any connection for blocked network requests) is enabled
  • Chrome 68 beta (no extensions): both dns-prefetch and preload work
  • At this point it's hard to say which of those behaviors are features or bugs and in which part of the stack.
like image 43
jakub.g Avatar answered Sep 22 '22 06:09

jakub.g