12

I'm running Chrome on Linux. I have local DNS to resolve *.myname.com into 127.0.0.2 (I type "host whatever.myname.com" or "host myname.com" and I see the correct address). However in Chrome when I type "myname.com" it is redirected to "www.myname.com" and solve the "real" website that I don't want.

Only when I type "test.myname.com", not "www.myname.com", Chrome correctly resolves it into 127.0.0.2. I guess Chrome is trying to do funky thing with www.anything.com and anything.com.

How to fix it?

PS: the local DNS I'm using is dnsmasq. If I explicitely put myname.com into /etc/hosts Chrome resolves it correctly into 127.0.0.2, but I can't use wildcard in /etc/hosts.

PPS: I can confirm at chrome://net-internals/#dns that Chrome correctly myname.com and www.myname.com into the real public IP.

2 Answers 2

6

In fact Chrome was using it own DNS client that talks with multiple DNS servers (the local DNS, the router DNS, the router DNS in IPv6). I go to chrome://flags and disable "Built-in Asynchronous DNS". Now it works.

5
  • 2
    The "Built-in Asynchronous DNS" flag was removed from Google Chrome, thereby disabling the "fix" for this. chromium.googlesource.com/chromium/src/+/… (from superuser.com/a/887191/109126)
    – jcisio
    Mar 9, 2015 at 11:54
  • 6
    This option was removed from Chrome, remove the answer to prevent confusion, or downvotes :D
    – sorin
    Apr 24, 2015 at 9:15
  • 1
    There's still some kind of issue here. I'm using Chrome 56 on Linux Mint, and it takes several minutes to resolve addresses after connecting to a VPN. Firefox does it immediately. It's seems that Chrome takes awhile to see changes in /etc/resolv.conf.
    – orodbhen
    Feb 22, 2017 at 12:21
  • 1
    It's still valid in Chrome for Android. The option is called "Async DNS resolver" (chrome://flags/#enable-async-dns)
    – MaxChinni
    Apr 4, 2018 at 10:18
  • 1
    there is no such option in 69+ and disabling chrome://flags/#enable-new-preconnect (mentions DNS) doesn't help
    – vladkras
    Sep 20, 2018 at 15:44
1

You can change your proxy settings and force it to use the address you want.

Open a new file, with .pac extention, those files are used by the system to determine proxies, copy this to the content of the file:

function FindProxyForURL(url, host) {
    if (host=='www.myname.com' || host=='myname.com'){
        return 'PROXY 127.0.0.2';
    }
    // All other domains should connect directly without a proxy
    return "DIRECT";
}

go to chrome proxy settings, and under "url for automatic proxy configuration" enter the path to that file.

no need to have DNS server, you can redirect it to different ports on the machine, and you can program it for your needs.

7
  • 1
    I used it when I used Mac, because in OS X I can use the .pac file for the whole system. Not in Linux AFAIK (it does not work with wget, curl etc.).
    – jcisio
    Oct 10, 2013 at 10:50
  • what linux do you have? (i have kubuntu and it's working)
    – Ohad Cohen
    Oct 10, 2013 at 10:54
  • Archlinux + KDE. I just don't believe Chrome settings can change OS behavior in the console.
    – jcisio
    Oct 10, 2013 at 13:23
  • chrome proxy settings just open system proxy settings
    – Ohad Cohen
    Oct 10, 2013 at 15:00
  • Thanks, I've just tested with xubuntu in my netbook. It couldnot open the systme proxy settings (the page chrome://linux-proxy-config/ gave an error). I'll try with my Archlinux later.
    – jcisio
    Oct 10, 2013 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.