There’s the always trusty localhost, but some programs allow you to use any domain you like, what domain (including top level domain) do you use (when developing locally) and why?

  • axidort@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    3 hours ago

    A few things that haven’t come up yet, since a lot depends on whether you want it to be just for you or something that can get real HTTPS.

    • For dev machines, use .test or .localhost. Both are reserved by RFC 6761, so they can never be registered by someone else and will never collide with a real site. .localhost also resolves to loopback by itself in most browsers, so myapp.localhost needs no hosts-file entry.
    • Avoid .local. As mentioned above, it’s reserved for multicast DNS (RFC 6762), so on a lot of systems the lookup goes to mDNS instead of your DNS server and you get random slow or failing resolution. .lan and .home are popular but not reserved by any RFC, so a clash with real DNS is possible in principle.
    • For a home network, the standard answer is home.arpa (RFC 8375). It’s reserved specifically for this, so nas.home.arpa is safe.
    • If you want valid certificates on LAN hosts (phones and some apps refuse custom root CAs), buy a cheap domain and use subdomains of it for internal hosts. You don’t have to expose anything: use a DNS-01 challenge with Let’s Encrypt, which proves ownership through a TXT record instead of an inbound HTTP request, and it also supports wildcard certs. Point the names at private IPs via your local DNS.
    • For purely local HTTPS on a dev machine, mkcert creates a local CA and certs for .test/.localhost names, trusted by your own browser, with no public domain required.

    So: .localhost/.test plus mkcert on the dev box, and an owned domain with DNS-01 for anything you want proper certs on.

  • flatbield@beehaw.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 day ago

    I purchased my own domain for stuff on my intranet, then use subdomains of that for my intranet hosts. I have a VPS on the internet I use to mint the certs with letsencrypt. Had to do it this way because android does not allow me to add my own root cert.

  • Zachariah@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    I bought a .land domain because it’s is similar to .lan, but since I registered it, I am in control of its dns.