Is it allowed to have an empty subdomain? E.g., is sub1..sub2.example.com
a valid domain name?
1 Answer
If I am reading the RFC correctly, labels (the parts in between the dots) in a domain name cannot be empty because the empty label is reserved:
Each node has a label, which is zero to 63 octets in length. [...] One label is reserved, and that is the null (i.e., zero length) label used for the root.
In other words, the "null label" is reserved for the root domain only. The root domain comes after the TLD in the full domain name, it is implicated in web browser DNS lookups if you leave it out, and it is generally ignored by anyone who isn't discussing DNS internals.
So for instance if we look at the true DNS representation of webmasters.stackexchange.com
it is actually webmasters.stackexchange.com.
with the trailing dot. This empty label that comes after the TLD is always reserved for the root, and cannot be used anywhere else in the domain name.
-
The root domain (trailing dot) isn't necessarily "hidden by web browsers" if the user explicitly enters this in the browsers address bar. In fact, this changes the request (
Host
header). If you try this onwebmasters.stackexchange.com.
you'll probably appear logged out. What is a "brother node"?– MrWhiteNov 17, 2018 at 2:02 -
@MrWhite Thank you for the correction. And I removed the part about the "brother node" because it isn't relevant to the answer. But if you're curious, afaik "brother nodes" just mean subdomain parts that are next to each other - so in the domain name
one.two.three.four.example.com
, the nodesthree
andfour
are brother nodes, butthree
andexample
orthree
andone
are not. Nov 17, 2018 at 2:16 -
I was kinda assuming "brother node" might mean that, however, it's ambiguous and I couldn't find any definition (and neither is it mentioned anywhere else AFAICS). It's really a parent/child relationship (not brother/sibling) that are arranged "adjacently" when the path is written out. Why didn't they use the term "adjacent"? However, and this further makes me doubt this definition, I'm not aware of any real-world DNS restrictions with regards to having two "adjacent" nodes with the same label? eg.
subdomain.subdomain.subdomain.example.com
would seem to be perfectly OK/valid?– MrWhiteNov 17, 2018 at 3:03 -
1@MrWhite I just tried adding a CNAME
example.example.example.com
in CloudFlare for a domain I own, and the DNS resolves just fine (in Chrome). I found a reference for "brother node" by the way. I think the rule (aided by the diagram) just says that you can't have two nodes with both the same parent node and also the same name. So, in other words, you cannot have duplicate FQDNs because to do so you would need to have duplicate "brother nodes" which is against the rules. This stuff was designed before I was born so that's the best I can speculate! Nov 17, 2018 at 3:34 -
2"If I am reading the RFC correctly": you are. As for "brother node" I never heard about that term in the DNS area. If you look at the future official "terminology" document on DNS stuff (at datatracker.ietf.org/doc/draft-ietf-dnsop-terminology-bis) you see nowhere the "brother" word. And this document was heavily worked on. Dec 14, 2018 at 22:56