Why can't I use a .dev address in my Windows hosts file for my development server?

Viewed 98

I tried to edit my Windows hosts file to route a bogus domain name to an IP address on my Local Area Network.

Why does this entry work:

webdev 10.10.1.100

But this does not? It causes every browser to "HTTPS" it.

web.dev 10.10.1.100
1 Answers

.dev is a Google TLD and is in the HSTS preloading list.

In short, that means all browsers will only do HTTPS call to any such names, never HTTP.

So don't use those names, at least not without an HTTPS webserver and the appropriate X509 certificate for the name, otherwise the browser will complain of mismatch and not even connect.

More generally, for local needs, do not "invent" names and TLDs. You will only get problems. Register once for all a domain, in any TLD, like example.com (but obviously not that), and then use it as suffix of any of the internal names you need. That solves all problems both now and in the future.

Related