Force capitalize letters in domain name [closed]

2020-04-09 03:08发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 6 years ago.

So I understand the fact that domain names are case insensitive:

google.com, GOOGLE.COM, GooGLe.Com, gOOgle.cOm ===> google.com

but my question is: Is it possible to force letters in a domain name to appear capitalized by default?

For example, if I owned www.crazycapitalization.com is there any way I could make it appear as CrazyCapitaliZation.com by default whenever the domain was accessed?

crazycapitalization.com, CRAZYCAPITALIZATION.COM ===> CrazyCapitaliZation.com

If this cannot be done I would be curious to know why.

Thanks in advance!

回答1:

The place to look this up is the Domain Names specification (RFC 2035).

It states that “while upper and lower case letters are allowed in domain names, no significance is attached to the case. That is, two names with the same spelling but different case are to be treated as if identical.” That's what you noted indeed.

Interestingly (and perhaps surprisingly to many), it also says that “when data enters the domain system, its original case should be preserved whenever possible” and “future additions beyond current usage may need to use the full binary octet capabilities in names, so attempts to store domain names in 7-bit ASCII or use of special bytes to terminate labels, etc., should be avoided.”

So in the original design, there was a possibility to preserve the case (even though comparison always happens in a case-insensitive way). However, when it resolves a domain name, your browser only asks the IP address belonging to that domain (and not the “canonical” name). So even if a certain DNS server would store case (usually not, as far as I know), your browser wouldn't use that information.

So it could be done, but only with a specifically crafted browser (and perhaps DNS server).
The cool thing is: you would still be respecting the DNS protocol.