Hey Everyone,
Currently I run 3-4 services on an old desktop I had lying around as my homeserver and I access them via Tailscale (either through http://machine:port or http://machine.tailnet.ts.net:port). Is it possible to setup a reverse proxy or similar to accomplish the following:
- Access the services through service.domain.com (I have a domain registered)
- Still only access through Tailscale (i.e. need to be connected to my tailnet for anything to load, I guess not exposing the port to the wider internet)
- Access through https so my browsers stop yelling at me
If so, how would I do this?
Yes, I have this set up. I would suggest doing this in stages.
- First stage, LAN setup:
- Pick a reverse proxy and get it working on the LAN with plain links (http://service.example.com/, no SSL). If it’s your first time using a reverse proxy, Nginx Proxy Manager has a GUI interface that’s easy to use. If you prefer to configure things by writing config files then Caddy, HAProxy and Traefik are other solid choices but there’s a bit of a learning curve involved with their config syntax ofc.
- You’ll have to be able to control your LAN DNS (typically lives on your router) to send
*.example.comto the LAN IP of the machine that the proxy lives on. - You also need that machine to always have the same IP, either set it statically or with DHCP (allocation by MAC address). Static is easier but make sure it doesn’t overlap DHCP’s dynamically allocated range.
- Secondly, get HTTPS going to you can access services at
https://on LAN.- Most reverse proxies have a built-in certbot that can get and renew Let’s Encrypt certs for free.
- You can also install and schedule Certbot (it’s a Python PIP CLI app) to run standalone on the machine if you want, it will produce the cert files and you can just point the proxy at them. This is useful if you’re using multiple proxies, or if you’re switching proxy at some point.
- You want to always get certificates for a wildcard (
*.example.com), never direct domains (jellyfin.example.comorexample.com). TLS certs are all public and there’s a public log that anybody can access. Direct certificates are only useful for public internet services (e.g. if you have a website atwww.example.comandexample.com). The public cert log is routinely used by malware bots to discover services to attack them, so the less information you give them the better. - This would be a good time to consider if you want to put services on the first subdomain level (
*.example.com) or at an additional sublevel (*.home.example.com). You can use anything instead of.home.of course. This can be good practice long term if you intend to use the domain in other ways in the future, for example you might decide to expose something to the internet at a direct subdomain (something.example.com) and it helps if the private stuff is clearly demarcated from the public stuff. - You can get multiple things on a single certificate. If you want both
*.example.comand*.home.example.comyou can make it a single cert, no need to get them separately. But getting them separately might be useful in some cases, for example let’s say you want*.example.comto be used by something living on a VPS or a cloud service, you would want to only give that certificate to that cloud machine, not also the cert for your home stuff. But if in doubt just get the one you need for now. - You need to prove to Let’s Encrypt that you own the domain each time you get or renew a certificate. This is done through a method called DNS-01 (mandatory if you want wildcards) that involves putting a secret code in a TXT record at
_acme-challenge.example.comfor a minute or so while LE verifies it. The proxy or certbot will do this for you automatically for every renewal, but it needs a key or token to modify your public DNS for example. com. This means that whatever service handles example.com for you needs to have an API for this. If you’re using your registrar’s DNS currently it may or may not have a LE-friendly API. You don’t have to change registrar if it doesn’t, you can delegate the nameservers to a DNS provider that does. DeSEC.io is a free one that’s privacy-respecting and works with LE, has API access and is known by most certbots and proxies.
- Third stage is getting Tailscale to reach your reverse proxy whenever you access
https://*.example.comwhen connected to it.- I’m guessing you have Tailscale running directly on the host machine that also runs the services and will run the proxy, and that the
tailscale0network interface is picking up service ports automatically when they bind to “0.0.0.0” or “all” interfaces. - You need to give the tailnode for the server a fixed IP in the Tailscale “machines” admin tab. It will be something in the 100.64.x.x range that Tailscale uses for its tailnets.
- You need a dedicated DNS server that resolves
*.example.com(or*.home.example.comif you decide to go with that) to that static 100.64.x.x address. Dnsmasq is a good choice, it’s small, very light on resources, and the config is a couple of text lines, basicallyinterface=100.64.x.xandaddress=/example.com/100.64.x.xis all you need (to bind and resolve, respectively, to that static address). - Last but not least you go to Tailscale admin “DNS” section, click on “add nameserver”, pick “Custom”, enter the static 100.64. IP there, and also check “restrict to domain” and put “example.com” there. Now Tailscale will send all requests for
*.example.comto your mini-DNS server, and it will resolve them to itself, and the reverse proxy is also there listening on that IP.
- I’m guessing you have Tailscale running directly on the host machine that also runs the services and will run the proxy, and that the
- First stage, LAN setup:
Yes. That’s what I do. Make a wildcard record that points to the TS IP of your reverse proxy. Then in the proxy, proxy to the desired service based on the subdomain. E.g.:
nextcloud.domain.com -> http://the-nextcloud-machine-on-tailscale:port
I’ve done it with Apache, but any reverse proxy should work. You could even get wildcaed Let’s Encrypt HTTPS working. The cert is installed in the proxy and it provides HTTPS for all services.
The system works when Tailscale is enabled. When it’s disabled the DNS record points to an unreachable IP.


