Recently, I set up a development environment server and I wanted to access it via a test domain I added in /etc/hosts file which I mapped to
localhost. The domain was
test.dev. While using
curl to test server response worked, entering the domain in Google Chrome browser would produce This site can’t be reached message:
It turns out that Chrome was redirecting to https and because my server wasn’t listening on port 443 I received the error. It was surprising because accessing the server on
localhost doesn’t result in redirect to https. In addition when I added
test.com to the /etc/hosts file no redirection occurred as well. Accessing
test.dev in Firefox resulted in the same behavior however accessing it in Brave browser did not result in redirect to https. After some digging into this I found that:
.devTLD was bought by Google.
- Chromium codebase which Google Chrome is based on has a file
transport_security_state_static.jsonwhich specifies several TLDs where
force-https. The list includes
.dev domain will be redirected to https in Chrome. According to Wikipedia the list of browsers which have a list of TLDs which are forced to load via https includes Firefox and Edge as well.