The Problem

Every homelab starts the same way. A service comes up on some address and port, and you bookmark it and click through a certificate warning. Then the second service arrives, then the tenth. Soon you have a folder of bookmarks like http://10.0.0.27:8000 and https://10.0.0.31:13378. The browser warns you on every visit. Phone apps refuse to connect at all, because they do not trust a self-signed certificate.

The warnings do the real damage. You learn to click “Accept the risk” on your own network. After that, you stop noticing when a warning means something.

I wanted each service to have a short name I can remember and a real padlock. I also wanted no new configuration for the next one. Today I have more than sixty proxy hosts that work exactly like that. Here is how.

Why a Real Domain, Not .local

The easy shortcut is an invented suffix: .local, .lan, .home. I did not use one, for two reasons:

  • Public certificate authorities only issue for domains you can prove you own. A browser never trusts a certificate for an invented suffix out of the box. You must run your own certificate authority and install its root on every phone, laptop and TV, forever.
  • .local is already taken. It belongs to mDNS (the protocol behind printer and speaker discovery). If you use it for normal DNS, you get slow lookups and odd failures. They are miserable to debug.

So I use a subdomain of a domain I already own: think lab.example.com. Every internal service lives one level below it: vault.lab.example.com, books.lab.example.com, home.lab.example.com. I publish nothing under that name to the internet. The domain gives me the names and the certificate, and that is all.

Layer 1: DNS at Home

My home network gets its DNS from my own resolver (AdGuard Home). DHCP hands it out to every device. It holds one rule that does almost all of the work:

# any single name directly under lab.example.com -> the reverse proxy
/^[^.]+\.lab\.example\.com$/$dnsrewrite=NOERROR;A;<proxy-ip>

That is all. vault.lab…, books.lab…, and any name I have not invented yet all point at one machine: the reverse proxy. I never add a DNS record for a new service.

Two refinements came later. Both came from real problems.

Deeper names answer “doesn’t exist”. At one point, a device had lab.example.com set as a DNS search domain. It looked up some unrelated name, and when the first attempt failed, it appended the search domain and tried again. Suddenly, lookups for things like api.someservice.com.lab.example.com matched my wildcard. My resolver answered with my proxy, and the lookup did not fail cleanly. The fix is a second rule that refuses anything more than one level deep:

# a.b.lab.example.com is never a real service: fail fast
/^[^.]+\.[^.]+.*\.lab\.example\.com$/$dnsrewrite=NXDOMAIN

Non-web services get exact records. The wildcard points everything at a web proxy. That is wrong for traffic that is not web traffic. My NAS speaks SMB, so it gets its own exact entry that points straight at the NAS. Exact entries win over the wildcard. That keeps it tidy: one rule for the common case, and a short list of exceptions.

Layer 2: DNS Everywhere Else

At home, my resolver answers. But what about my phone on cellular, or my laptop in a café?

The answer is surprisingly boring. The same wildcard also exists in public DNS, and it points at the proxy’s private address.

*.lab.example.com.   A   <proxy-private-ip>     ; DNS only, not proxied

Now any resolver in the world answers vault.lab.example.com with an internal address. For a stranger, that address is a dead end. It is a private range that routes nowhere on the internet. For me, away from home with my private mesh (Tailscale) connected, the tunnel routes that range back home. The same name, the same certificate and the same bookmark work on the couch and at the airport. I did not have to set up split DNS on every device.

These are the trade-offs, honestly:

  • It reveals one internal address and the shape of my naming. I am fine with that. Nobody outside can reach the address, and no name holds anything sensitive. If that bothers you, use split DNS on the mesh instead.
  • Some routers strip private answers from public DNS (DNS rebinding protection). At home, my own resolver answers first, so this never comes up.
  • On a network that strips them, the names will not resolve. If you hit that often, point your mesh’s DNS at your home resolver.

Layer 3: One Wildcard Certificate

Every name lands on the reverse proxy (Nginx Proxy Manager). So the proxy is the only thing that needs a certificate. It holds exactly one: a Let’s Encrypt certificate for *.lab.example.com and lab.example.com.

A wildcard certificate needs the DNS-01 challenge. Let’s Encrypt does not connect to a web server to check that you control the name. You prove control with a temporary TXT record. The proxy makes that record through my DNS provider’s API. This is the same step by hand:

certbot certonly \
  --dns-<provider> \
  --dns-<provider>-credentials /path/to/api-token.ini \
  -d 'lab.example.com' -d '*.lab.example.com'

This is why it matters:

  • Nothing is exposed to the internet. No port 80 or 443 is open at home for validation. The whole exchange is a TXT record.
  • Scope the API token narrowly: DNS edit for this one zone and nothing else. If it leaks, the damage stays in DNS records. The rest of the account is safe.
  • Renewal is automatic. Let’s Encrypt certificates last 90 days, and the proxy renews them well before expiry. I do not think about it.
  • Every service shares it. All 63 proxy hosts point at the same certificate. A new service needs no certificate request. It picks the one that already exists.

Remember one rule: a wildcard covers one level only. It covers vault.lab.example.com but not a.vault.lab.example.com. That is one more reason my DNS refuses deeper names. If the certificate cannot serve a name, the name should not resolve.

The Front Door: Proxy + Single Sign-On

Every name lands in one place, so the proxy becomes a natural front door. Most hosts include a forward-auth check against my single sign-on (Authelia). The first time I open any service, I sign in once. After that, Authelia remembers the session, and every other service opens directly.

A few services sit outside that gate on purpose: the password manager, the media server and notifications. Mostly, their own apps cannot handle a login page in front of them. Those services use their own logins.

One surprise is worth sharing: my mesh reaches the home network through a subnet router that rewrites the source address. So every remote client arrived as one internal machine. That address matched the “trusted LAN” rule in my SSO, so the SSO never asked remote users to log in. The fix was a rule for that one address, placed before the LAN rule. Remote traffic always signs in, and home traffic keeps its shortcut. If your sign-on trusts “the local network”, check how your VPN traffic looks when it arrives.

Adding a Service Now

This is the payoff. When something new joins the lab, this is the whole network part:

  1. Start the service on any internal address and port.
  2. In the proxy, add one proxy host: newthing.lab.example.com → that address and port. Pick the existing wildcard certificate and include the SSO snippet.

That is the list. I add no DNS record, because the wildcard already answers. I make no certificate request, because the wildcard already covers it. Nothing changes on any client, at home or away. The service is live with a real padlock about a minute after I save.

The rest of my checklist is about the lab, not the network: a tile on my dashboard, an uptime monitor and a backup check.

home.lab: Where It All Comes Together

The name I type most is home.lab.example.com. It is my front page, a dashboard I built. It has a tile for every service, a live clock and weather, live system telemetry and a scrolling log from my network sentry. On my laptop, the same page runs as my desktop wallpaper. The lab is literally the background of my day.

Here the three layers stop being plumbing and start to feel good:

  • Every tile is a plain link. No ports, no IPs, no “proceed anyway”. Click a tile, and the service opens with a valid padlock.
  • One sign-in covers the whole page. The dashboard and the services share the same domain and SSO session. A move between them never asks twice.
  • It is the same everywhere. On the couch or across the country, the same names resolve and the same certificate matches. The same page loads.

No single part is clever: a regex in a resolver, a wildcard record, a wildcard certificate and a proxy. Together, they make sixty-odd services feel like one coherent place. That is what I mean by “it just works”. There is no magic. There is only no friction left to notice.

Takeaways

  • Use a real domain you own for internal names. You get trusted certificates, and you do not fight .local.
  • Point one wildcard DNS rule at your reverse proxy. Then you never add a DNS record for a new service.
  • Refuse names deeper than one level. They are search-domain accidents, and a wildcard certificate cannot serve them anyway.
  • Give non-web services (like a NAS) exact records, so they bypass the proxy.
  • A public wildcard to a private address works anywhere your private mesh reaches, and nowhere else.
  • Get the wildcard certificate with the DNS-01 challenge and a narrowly scoped API token. No ports open, renewal automatic.
  • Put single sign-on on the proxy, and check how VPN traffic appears to it.
  • “Trusted LAN” rules can quietly trust the whole mesh.
  • Build one front page that links it all. With consistent names, certificates and sign-in, that page makes the lab feel finished.