blog.chay.dev

localdev.me

Update: as of 9 May 2025, someone else registered the localdev.me domain, so this doesn't work anymore.

Assumed Audience: devs with some knowledge of DNS

TIL: localdev.me is a domain which resolves to 127.0.0.1.

$ dig localdev.me +short
127.0.0.1

I chanced upon this when reading a documentation on setting up ingress-nginx.

Why not just use localhost?

localdev.me also supports nested subdomains.

$ dig example.localdev.me +short
127.0.0.1

$ dig another.example.localdev.me +short
127.0.0.1

$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.086 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.282 ms

$ ping example.localhost
ping: cannot resolve example.localhost: Unknown host

Plus, localhost is a reserved domain, which makes it susceptible to being handled differently by different applications. For example, a browser may have special CORS or cookies policies for localhost.

Why not modify the hosts file and use your own domain?

localdev.me is a zero-config tool.

Hosts file modification is also OS-specific..

huh isn't it just /etc/hosts?? Nope. On Windows, it's C:\Windows\System32\drivers\etc\hosts, on WSL, it's symlinked to the Windows counterpart, and on Android, it's /system/etc/hosts.

.. and neither is it a reliable mechanism. Lots of applications (e.g. VPN, MDM, ad blockers, etc.) modify/override the hosts file.

Why not use a local resolver and use your own domain?

That's more complicated than modifying the hosts file.

Who owns localdev.me?

No idea. I tried doing a WHOIS lookup, but gandi.net's Private Whois feature is enabled by default.

Are there other alternatives?

Yes:

Only localdev.me does not have a landing page, since the root domain resolves to 127.0.0.1.

When should I not use localdev.me?

If you have trust issues.

Or if your use case is more complicated than just "resolve this domain and all the subdomains to 127.0.0.1". In that case, use dnsmasq, unbound, or the good ol' systemd-resolved.

#dev