The correct way to write a domain name is to end it with a '.' (dot).



When writing

a fully qualified domain name (FQDN) without abbreviating the domain, the correct way to write it is to add a '.' (dot) at the end. dns-sd.org, a website that compiles information about DNS service discovery tools (DNS-SD), provides information about when the presence or absence of a trailing dot can be a problem.

Trailing Dots in Domain Names
http://www.dns-sd.org/trailingdotsindomainnames.html



Although it is not well known, for example, if you try to access GIGAZINE by adding a ' . ' (dot) at the end instead of ' https://gigazine.net ', the official notation for a fully qualified domain name is to add a dot at the end.



RFC 1034 , the document that defines the DNS specifications published in 1987, states the following:

When a user needs to type a domain name, the length of each label is
The labels are separated by dots ('.').
The domain name ends with the root label, this leads to a printed form which
ends in a dot. We use this property to distinguish between:
(When a user types a domain name, the label length is omitted and the labels are separated by dots, '.'. A complete domain name ends with the root label, so it is written to end with a dot. We use this property to distinguish between:

- a character string which represents a complete domain name
(often called 'absolute'). For example, 'poneria.ISI.EDU.'
(A string that indicates a complete domain name, also known as 'absolute', e.g. 'poneria.ISI.EDU.')

- a character string that represents the starting labels of a
domain name which is incomplete, and should be completed by
local software using knowledge of the local domain (often
For example, 'poneria' used in the
ISI.EDU domain.
(A string representing the starting label of an incomplete, sometimes called 'relative', domain name that must be completed by software using local domain knowledge; for example, 'poneria' in the 'ISI.EDU' domain.)



The difference between absolute and relative domains is like the difference between absolute and relative file paths in Unix: in Unix, if the file name starts with a slash, it specifies an absolute path, and if it doesn't start with a slash, it specifies a relative path that doesn't depend on context such as the current working directory.

For example, when you enter a command like 'emacs', Unix looks up the $PATH environment variable to find the executable file. On the other hand, if you execute a command like '/usr/bin/emacs', the specified file will be executed directly, making it clearer which program is being executed.



In DNS, you can complement domains by using a search list . For example, if the search list is set to 'tokyo.example.jp', 'paris.example.jp', and 'example.jp', when a user enters 'www' into a web browser, the OS will search for the domains 'www.tokyo.example.jp', 'www.paris.example.jp', and 'www.example.jp' in that order.

The problem here is that even if a person sees a complete domain name as 'www.example.net', the DNS recognizes that if it does not end with a '.', it is a relative domain. For this reason, even if you enter 'www.example.net', the search list function will be activated and you may get a domain other than the intended one, such as 'www.example.net.example.com'. This problem can be solved by adding a '.' at the end to indicate that it is a fully qualified domain name, such as 'www.example.net.'

In particular, when creating software that embeds the server's domain name, if the domain name does not have a dot at the end, it may be searched according to the user's DNS search list. In most cases, the connection will be successful even without a dot at the end, but if you don't want to worry about the user's search list settings when a DNS-related problem occurs, it is better to use a fully qualified domain name with a dot at the end.

The people who wrote the HTTP protocol understood this problem, and RFC 1738 specified that the 'Host' header should use a 'fully qualified domain name':

Common Internet Scheme Syntax

//<user>:<password>@<host>:<port>/<url-path>

host
The fully qualified domain name of a network host



However, most web browsers use the user's input as is in the 'Host:' header when accessing a site, rather than the fully qualified domain name that the computer constructed based on the user's input and used to connect. Therefore, when accessing a site such as 'www.example.com', there are three possible patterns for the 'Host:' header:

- The relative domain 'www.example.com'
- The fully qualified domain 'www.example.com.'
- The actual part of the user's input when 'example.com' is completed by the search list 'www'

Regarding the lack of uniqueness of the Host header, the original article states, 'Unfortunately, web browser implementors do not seem to understand the value of using a fully qualified domain name.'

In addition, since using search lists can also cause conflicts with other TLDs, the Japan Network Information Center (JPNIC) is urging people not to use search lists .

in Software,   Web Service, Posted by log1d_ts