Today, I tried to open https://create-react-app.dev and look for some manual. But I hit the wall; I couldn’t open it. The browser gave me the below error message:
This site can’t be reached create-react-app.dev refused to connect. Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED
I flipped the link to my wife and she confirmed that she was able the access the link. Neither reconnecting Wi-Fi nor Logging out solved the problem.
I needed to fix it, cause I need to read the document! Errrrr. So, I started my debugging process.
First, I needed to confirm it’s not my browser’s problem. So, I used curl:
curl -vvvv https://create-react-app.dev * Trying 127.0.0.1... * TCP_NODELAY set * Connection failed * connect to 127.0.0.1 port 443 failed: Connection refused * Failed to connect to create-react-app.dev port 443: Connection refused * Closing connection 0 curl: (7) Failed to connect to create-react-app.dev port 443: Connection refused
The curl output showed the same result with more information; the domain got resolved to my localhost: 127.0.0.1.
I doubled-checked through
traceroute. Bad luck as well.
$ ping create-react-app.dev PING create-react-app.dev (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.050 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.117 ms $ traceroute create-react-app.dev traceroute to create-react-app.dev (127.0.0.1), 64 hops max, 52 byte packets 1 localhost (127.0.0.1) 0.472 ms 0.042 ms 0.037 ms
nslookup didn’t think the domain should be
$ dig create-react-app.dev ... create-react-app.dev. 299 IN A 126.96.36.199 create-react-app.dev. 299 IN A 188.8.131.52 $ nslookup create-react-app.dev Server: 184.108.40.206 Address: 220.127.116.11#53 Non-authoritative answer: Name: create-react-app.dev Address: 18.104.22.168 Name: create-react-app.dev Address: 22.214.171.124
So, it must be somewhere on my localhost overwriting the dns resolving results.
The first place I suspected was
$ cat /etc/hosts 127.0.0.1 localhost
Well, it seems this file didn’t give any instruction to amend the dns resolving results.
Then, I found there was a directory that was really suspicious:
What’s under this directory?
$ ls /etc/resolver dev
What the hell?
$ cat /etc/resolver/dev # Lovingly generated by Pow nameserver 127.0.0.1 port 20560
Hmm, I think I found the root cause. I removed the file and cleaned the dns cache:
$ ps aux|grep dns _mdnsresponder 64913 0.0 0.0 4381768 6468 ?? Ss 10:59AM 0:00.18 /usr/sbin/mDNSResponder $ sudo kill -9 64913
Hooray, it worked!
$ curl -I https://create-react-app.dev HTTP/2 200
Then I realized that I installed Pow several years ago and
configured it for aliasing any domain
*.dev to my localhost. I re-readed Pow’s
documentation and found the warning:
Adding top-level domains like “.com” to POW_DOMAINS can be hazardous to your health! In the (likely) event that at some point you lock yourself out of these domains, you will be unable to reach important remote addresses like github.com (where you can find the source code) and S3 (where Pow’s installation and uninstallation scripts are hosted). Do not panic! Delete the files Pow has created in /etc/resolver/ and DNS activity will return to normal. (You can safely use POW_EXT_DOMAINS for these domains instead.)
It applies to
- You can tamper DNS results via
- Launching a local DNS server may be a better approach.
- The list of top-level domains is expanding.