• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    24
    ·
    22 hours ago

    There’s another, more DNS-related, reason why it was usually preferred to have something before the domain part. It’s possible to alias a subdomain to another subdomain, but not so with the root of a domain, which must point directly at a single IP address.

    If your IP addresses are more subject to change than your hostnames, or your site was hosted on a third party service, then it made sense to point www at a particular hostname rather than its address. e.g. you might point www.your-domain-here.biz at a-hostname.the-hosting-provider.tld. That’s not possible with a root domain. IP address or nothing.

    Similarly, it’s possible to point a subdomain at multiple IP addresses (or multiple hostnames) at the same time, which was a cheap way to do load balancing. i.e. For a site a user hadn’t visited before, they’d be basically told one of the listed IP addresses at random, and then their local DNS cache would return that one IP address until it expired, generally giving enough time for the visitor to do what they wanted. Slap 8 different IPs in the www subdomain and you’d split your visitors across 8 different servers.

    Root domain has no such capability.

    Technically it would be possible to do all of that one level higher in DNS where your domain itself is the subdomain, but good luck getting a domain registry to do that for you.

    I haven’t done DNS in over a decade at this point, so things may have changed in the intervening years, but this was all definitely a thing once upon a time.

    • Max-P@lemmy.max-p.me
      link
      fedilink
      English
      arrow-up
      13
      ·
      21 hours ago

      You can return multiple A/AAAA records for the root, the TLD delegates the whole thing to your nameservers and it’s free to return whatever you want. Registrars actually do let you set records on the TLD’s zone, it’s called glue records and they’re typically used to solve the nameserver chicken and egg problem where you might want to be your own nameservers. Mine’s set that way:

      ~ $ drill NS max-p.me
      ;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 32318
      ;; flags: qr rd ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
      ;; QUESTION SECTION:
      ;; max-p.me.    IN      NS
      
      ;; ANSWER SECTION:
      max-p.me.       3600    IN      NS      ns2.max-p.me.
      max-p.me.       3600    IN      NS      ns1.max-p.me.
      

      The me registrar will give you the IP for those two so you can then ask my server for where max-p.me really is.

      The bigger issue is usually there’s a bunch of stuff under your root domain like MX records, TXT records, potentially subdomains. That’s a huge problem if you need to CNAME the root to a hosting provider, as the CNAME will forward the entire domain including MX and TXT records. Cloudflare sort of works around that with server side flattening of CNAMEs, but that’s not standard. But if you have a www subdomain, then it’s a complete non-issue. And really, do you want to delegate your MX records to WP Engine?

      The main reason people went without the www is the good old “it looks cooler and shorter” while ignoring all the technical challenges its brings, and that’s probably why browsers now hide the www so that website designers don’t have to do this atrocity.