ysbaddaden/prax

Chrome can't resolve .dev domains

ysbaddaden opened this issue · 14 comments

Chrome reimplements its own DNS resolver, and skips NSSwitch: https://code.google.com/p/chromium/issues/detail?id=117655 named Async DNS resolver. So Chrome isn't compatible with Prax, unless you use xip.io, switch the flag off (in Chrome < 41) --disable-async-dns or configure dnsmasq or bind or unbound locally.

Please not that all other browsers do work perfectly with the system configuration.

Sorry, I didn't see this when I created #118.

It goes a bit further than chrome: NSSwitch is only available with glibc. Alternatives like musl don't implement it either.

Configuring dnsmasq may be a better solution than an NSSwitch extension. A simple script like the following, placed in either /etc/NetworkManager/dnsmasq.d (stock Debian/Ubuntu) or /etc/dnsmasq.d (installed resolvconf and dnsmasq manually) should do the trick:

local=/dev/
address=/dev/127.0.0.1

Installing the script will require to restart NetworkManager or dnsmasq.

I created the above script as /etc/NetworkManager/dnsmasq.d/prax and restarted NetworkManager: sudo restart network-manager. I'm now able to resolve .dev domains as 127.0.0.1 using dig, host and Chromium 41 with the Asynchronous DNS resolver enabled.

This should work on Debian, as long as the dnsmasq-base package is installed. The same should apply to Fedora (I don't know which package is required, maybe it is already installed, like for Ubuntu).

For other distributions, or if you don't use Network Manager, then installing dnsmasq will do the trick to. You should create the script in whatever the --conf-dir option for dnsmasq is pointing to, or directly in /etc/dnsmasq.conf then restart dnsmasq.

Please note that once dnsmasq is configured, the NSSwitch extension is no longer required, so it may eventually be deprecated —but kept as an alternative solution to dnsmasq.

Implementing this actually caused both Chrome and Firefox to start reporting 'Connection Refused' instead!

I am using the lastest version of Chrome (48.0.2564.116) and I am getting ERR_CONNECTION_REFUSED.

I have tried the above network manager fix but with no luck.

I am using Ubuntu 15.10

Is there an easy fix for this?

It's quite possible (if not highly probable) that the problem lies with systemd?

I personally only use the crystal version of Prax on Ubuntu Trusty and I have no problem, so I don't know.

I was able to access my .dev domains on Debian 8 after running sudo apt-get install dnsmasq resolvconf. I'm not sure if this was relevant or not, but I had also restarted my computer after installing the .deb, but before running those commands.

I found so much confusing information about prax on the web. Someone that really knows prax well should write a definitive guide. "sudo apt-get install dnsmasq resolvconf" did it for me. After that, just run prax. THANK YOU!
(Rails 2.3.18 on Ubuntu 15.04 LTS.)

How can I use .test instead of .dev ?

@brunobrgs There is an open PR in the Crystal version of Prax providing that behavior: ysbaddaden/prax.cr#68

Hopefully we can get it merged and released soon, but if you don’t want to wait then you could could compile prax.cr on that branch and use that.

I change this line here: https://github.com/ysbaddaden/prax/blob/master/ext/nss_prax.c#L63 to test and installed again, it worked. Thanks