According to RFC 2606 (1999) the TLD .localhost is reserved for use for testing locally.
The goal is to configure a preview site to run locally using the TLD .localhost, e.g. http://example.localhost
The problem is that when I use Chrome or Safari to access a '.localhost' TLD it searches google for example.localhost instead of treating it as a proper address. This is after configuring the hosts file to point back to 127.0.0.1
.
Am I misunderstanding the usage of this reserved TLD? Is there a way to configure this to work properly?
.localhost
is not an existing, delegated TLD, which is why your browser doesn't find it.
What RFC 2606 says is that .localhost
(along with .test
, .invalid
and .example
) will never be a delegated TLD, so you can safely use that name for your own, local, purposes. That is, if you want to set up a private TLD for internal use, that TLD can be safely named .localhost
without the risk of a future collision with a globally assigned name.