Hacker News new | ask | show | jobs
by inigyou 5 days ago
The better pattern is to use an underscore prefix like _discord-verification.domain.com

If your site allows user-created subdomains it shouldn't allow leading underscore. This is reserved somehow.

2 comments

Why would you want a new prefix over using record types as they were meant to be used?
Because:

1. Practically, the process for creating a new DNS record type is bureaucratic and slow.

2. New record types have a limited number, but names are unlimited as long as they are unique.

3. If the data you’re storing is perfectly compatible with an existing record type, like TXT, it seems silly to overload semantics into a new, but otherwise identical, record type. You can compare record types to variable types in a programming language. I.e. instead of having

  name_t x = "foo";             /* C */
  x: Name = "foo"               # Python
  x       IN      NAME    "foo" ; DNS
you instead have:

  char *name = "foo";           /* C */
  name: str = "foo"             # Python
  _name   IN      TXT     "foo" ; DNS
Sure, DNS might not have integer types, but it has host names (PTR), IP addresses (AAAA and A), and strings (TXT, which also can work as an array of strings up to 255 bytes in length if you prefer). These, with added semantics of an underscored name prefixed, will get you quite far without having to invent a new record type to contain your specific semantic meaning to, say, a plain TXT record.
because IANA won't allocate a number for discord domain verification
Why wouldn't they?
for the same reason they won't approve a special HTTP version that can only be used by Chrome to access Gmail
Underscores are not “reserved somehow”. Underscores are simply not allowed in “host names”; i.e. names with either AAAA or A records, or where the record data has a host name target, like CNAME, MX, SRV, SVCB, or HTTPS records (or any similar record types containing host names).