Don’t use “.dev” for local development.

Jonathan Geier
2 min readDec 22, 2017

Seems like every time I update to the most recent OS on my Mac, it breaks my dev environment by overwriting all of my Apache settings back to default, and I have to go through through and change them all back. Then I have to update Brew, Xcode, Xquartz, and restart Apache a bunch of times.

When I couldn’t pull up any of my local projects, or even my local home page (“code.dev”) about a week ago, I figured my recent update to High Sierra to be the culprit.

Having done this a few times before, I knew what needed to be done. But even after going through all the motions again, my dev environment still wasn’t working.

http://localhost/” and “http://127.0.0.1/” both worked just fine. Any “*.dev” address resulted in an unexpected, somewhat vague error in Chrome, stating the “connection was denied” (something like that). I tested it in Safari and got the same result. Server logs didn’t indicate any problems. Then I noticed that HTTPS was being forced…

After a few frustrating, late night hours digging through Google, I finally found the answer to my problem: https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/

As it turns out, “.dev” is now a registered, top level domain. But the kicker is (I guess) that now modern browsers also force HTTPS protocol when visiting a website with such a domain for some reason.

Now that I understand the gist of what the problem was: when trying to pull up my local dev in a browser, the browser insisted that I was trying to pull up a live website on the public internet.

So if your dev environment suddenly stops working for no apparent reason, and the usual fixes aren’t working, this may be your problem.

In closing, I guess you can’t use local “.dev” domains anymore. From the sound of it, you may not be able to anyway. I’ve read a few suggestions, but the general consensus seems to be “.localhost”, as it stands to reason there is little chance of that ever becoming a public top level domain.

--

--

Jonathan Geier
0 Followers

Web developer in Green Bay, Wisconsin.