Mobile app version of vmapp.org
Login or Join
Alves908

: Must I use a Top Level Domain (TLD) for localhost websites? I've always used name.dev for local development, but since Google Chrome 63 update, out December 2017, domains with .dev are in the

@Alves908

Posted in: #Domains #Localhost #TopLevelDomains #WebDevelopment

I've always used name.dev for local development, but since Google Chrome 63 update, out December 2017, domains with .dev are in the preloaded HSTS list with a rule enforcing HTTPS, no workarounds.

IETF states a few reserved TLDs for development:



TLDs for Testing, & Documentation Examples

There is a need for top level domain (TLD) names that can be used
for creating names which, without fear of conflicts with current or
future actual TLD names in the global DNS, can be used for private
testing of existing DNS related code, examples in documentation, DNS
related experimentation, invalid DNS names, or other similar uses.

For example, without guidance, a site might set up some local
additional unused top level domains for testing of its local DNS code
and configuration. Later, these TLDs might come into actual use on
the global Internet. As a result, local attempts to reference the
real data in these zones could be thwarted by the local test
versions. Or test or example code might be written that accesses a
TLD that is in use with the thought that the test code would only be
run in a restricted testbed net or the example never actually run.
Later, the test code could escape from the testbed or the example be
actually coded and run on the Internet. Depending on the nature of
the test or example, it might be best for it to be referencing a TLD
permanently reserved for such purposes.

To safely satisfy these needs, four domain names are reserved as
listed and described below.

.test
.example
.invalid
.localhost


".test" is recommended for use in testing of current or new DNS
related code.

".example" is recommended for use in documentation or as examples.

".invalid" is intended for use in online construction of domain
names that are sure to be invalid and which it is obvious at a
glance are invalid.

The ".localhost" TLD has traditionally been statically defined in
host DNS implementations as having an A record pointing to the
loop back IP address and is reserved for such use. Any other use
would conflict with widely deployed code which assumes this use.



But I was wondering if I could use something shorter.

Is it ok to use only name for local websites?

I mean, only the project name, without TLD. Similar to the
localhost "domain" itself.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

The domain name in the URL name/ does have a TLD, or rather: it consists only of a TLD (name). It would be name./ as FQDN, but the variant without the . typically works in browsers, too.

While it’s uncommon that TLD owners make the TLD itself resolvable, some do. For example, this was the case with to/, and it still is the case with dk/.

As of posting this answer, you can test it yourself: dk/ (currently redirects to a third-level domain name).

So is it "okay" to use them?


No, if you want to prevent the possibility of getting surprised again in the future. The project name you choose could become a TLD, and this TLD could itself become resolvable. To be safe, stick with the reserved TLDs.
Yes, if you can live with this risk. But if you use non-reserved TLDs, it might be a good idea to configure your system in such a way that DNS requests to these TLDs won’t go out.

10% popularity Vote Up Vote Down


 

@Becky754

Yes. Depending.

Client Side:

Most OSs allow for the editing of the hosts or hosts.txt file to associate a network name or domain name with an IP address. This is a client side option. You would do this on your desktop computer so that it knows how to address the request packet. Here is more detailed information including example settings.
en.wikipedia.org/wiki/Hosts_(file)
You can configure another name for localhost, however, just adding a name will allow you to access the web server from a client on the same network. You would have to make this entry for all of the computers you expect to use in this manner. Assuming you are a developer, this is often the case where the client and web server are two different computers. Do not expect this to always work through a firewall over the Internet. It can, however, some firewalls may not allow it.

You can set your computer to use a search domain to append a domain name to the short name you provide. There is an excellent answer here for this. serverfault.com/questions/23397/resolving-host-names-to-their-domain-name-in-an-internal-bind-domain/23401#23401 This also requires a configuration change per computer that you intend to use in this manner.

Server Side:

The problem begins with the web server. The assumption is that the web server can handle the name. Certainly, myawesomesite.test can easily be configured as a site. However, myawesomesite without the TLD may not be configurable. There are ways around this.

For example, with Apache, when a request packet comes in, Apache will try and match it with a configured site. If it cannot, it will serve the first site created. Often, this will be configured as a catch-all site intended to capture invalid requests and IP address only requests. This is not always done. However, the first site created can always be used for any site that cannot be properly configured by name or IP address only sites. Other web servers do this as well.

Certainly, any Apache server can be reconfigured to add a catch-all site where one does not exist. I cover some configuration examples here where a catch-all site exists. Virtualhost config: routing and wildcard usage Always take this task on with caution. You will likely have to experiment if you are not familiar with Apache configuration. And as always, Apache will have to be restarted before the configuration changes are taken in consideration.

As @StephenOstermiller points out in the comments, any existing site can simply have 'ServerAlias' set to an alternative name such as myawesomesite.test. He also points out that a shorter name can be used. I have not ever tried this. It costs relatively nothing to try it.

IIS should be able to use a NetBios name. If you are using a Windows network, you can look into this and it should do what you want.

For other web servers, I cannot give advice. Sorry. However, there is likely an answer if you research.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme