I use Tailscale for most things on my server, and the part I reach for most often is tailscale serve. One command gives a web app that only listens on localhost a proper HTTPS address on your tailnet, with a real certificate and no port forward. Its sibling tailscale funnel does the same thing for the whole internet, and that one deserves a lot more caution. Here is how both work, how to put a Docker container behind them, when I’d use which, and the small identity trick that lets a service know who is knocking.
- Time
- 11 min
- Steps
- 8
- Updated
- 21 Nov 2026
You will learn
- Serve a local web app
- A path, a port, or short HTTP
- Put a Docker container behind it
- The identity trick
- Not everything is a web app
What you get and what you need
Serve takes traffic from other devices on your tailnet and routes it to a service on the machine where you run the command. Your tailnet needs HTTPS certificates switched on, and access rules apply as usual: if your ACLs say a device may not reach this machine, Serve does not change that. If HTTPS is not enabled yet, tailscale serve sends you to a consent page that turns it on.
The CLI changed in client 1.52, so older blog posts with tailscale serve https / http://... no longer match. Everything below uses the current syntax from the Tailscale docs. Serving a file or a folder needs root (sudo on Linux); forwarding a port does not.
A note for Unraid users: the Docker tab has its own Serve and Funnel switches when you turn on Use Tailscale for a container, and I wrote that setup up in an earlier guide. This one is about the command line, which works on any machine with Tailscale on it: a laptop, a VPS, a Raspberry Pi, the Unraid host itself.
The picture below is the whole idea. Serve is the top row and stays inside your tailnet. Funnel is the bottom row and does not.

Step 1 of 8: Serve a local web app
Say something listens on port 3000 on the same machine. One command puts it on your tailnet:
tailscale serve 3000
The CLI opens a foreground session and prints the address, which looks like https://my-node.example.ts.net, with the target underneath. The name is always your device name plus your tailnet’s domain; Serve cannot use any other DNS name. Open it from your phone with Tailscale on and you get a padlock without ever touching a certificate.
Press Ctrl+C and the share stops. To keep it running, add --bg:
tailscale serve --bg 3000
tailscale serve status
--bg runs it in the background. The docs say it resumes by itself after a reboot or a tailscale down and up, while a share without --bg has to be started again by hand, so I use it for anything I want to keep. tailscale serve status lists what is being shared, and tailscale serve reset clears the whole configuration.

The target does not have to be a port. A full URL works, a file or folder path works too (that one needs root), and there is a static text target for testing:
tailscale serve --bg localhost:3000
sudo tailscale serve --bg /home/you/site/index.html
tailscale serve --bg text:"Hello from my tailnet"
The static text one is more useful than it looks. Before you point Serve at a real app, serve a line of text and check that your phone can open the address. If that works, the tailnet, the certificate and the DNS name are fine, and any later problem is in the app.


One limit to remember: a reverse-proxy target is expected to be on 127.0.0.1. If your backend runs with a self-signed certificate, use https+insecure://localhost:8443 as the target.

Step 2 of 8: A path, a port, or short HTTP
You can put several things behind one name with --set-path, each on its own path, or give a service its own HTTPS port:
tailscale serve --bg --set-path /grafana 3000
tailscale serve --bg --https=8443 8080
Check the app behind a path before you trust it, because many web apps assume they live at / and break when their links get a prefix. A separate port is the safer choice for those. --http=80 also works, and plain HTTP servers answer on short MagicDNS names such as http://my-node, which is useful on a trusted network.
To switch one share off without resetting everything, repeat the command with off at the end. The original flags are required there, the target is optional:
tailscale serve --https=8443 off

Step 3 of 8: Put a Docker container behind it
Most of what I want to share runs in a container. Serve only proxies to 127.0.0.1, so the container has to be reachable on the host’s loopback address. Publish its port on localhost only, not on all interfaces:
docker run -d --name myapp -p 127.0.0.1:3000:3000 myimage
# or in a compose file
ports:
- "127.0.0.1:3000:3000"
Then tailscale serve --bg 3000 as before. The 127.0.0.1: in front of the port is the important part. Without it Docker publishes the port on every interface, which means the app is also reachable on your LAN without going through Serve, and that undoes the point of putting it behind your tailnet. It also matters for the next section, because a service that trusts Tailscale’s identity headers must not be reachable any other way.
Prefer to leave the host out of it? Then run Tailscale inside or next to the container. Unraid’s per-container switch does exactly that, and the guide linked at the top covers it.
Step 4 of 8: The identity trick
This is the part I like most. When Serve proxies a request from your tailnet, it adds headers to it: Tailscale-User-Login, Tailscale-User-Name and, if your identity provider has one, Tailscale-User-Profile-Pic. Serve strips those headers from incoming requests first, so nobody can fake them from the outside. A backend that understands them, like a custom app or a proxy-auth setup in front of something such as Grafana, can log you in by who you are on the tailnet instead of asking for a password.
You can see what your own app would receive with a few lines of Python. This tiny server greets whoever Serve says is calling, and says “nobody” when the header is missing:
from http.server import BaseHTTPRequestHandler, HTTPServer
class H(BaseHTTPRequestHandler):
def do_GET(self):
who = self.headers.get("Tailscale-User-Login", "nobody")
body = f"Hello {who}\n".encode()
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
HTTPServer(("127.0.0.1", 3000), H).serve_forever()
Run it, put tailscale serve --bg 3000 in front of it and open the address from your phone. You should see your own login name. Open http://127.0.0.1:3000 on the server itself and you see “nobody”, so only the Serve route carries an identity.
Three caveats, all from the docs. Traffic from tagged devices does not get the user headers. Funnel traffic never gets them, because it is public. And traffic from someone you shared a device with does count as tailnet traffic, so that friend arrives with their own identity. The docs add a rule I’d copy exactly: when a backend trusts these headers, let it listen on localhost only. If it also listens on your LAN, anyone who can call it directly can send their own header values.
Newer clients (the docs say v1.92 or later) can also forward app capabilities from your policy file in a Tailscale-App-Capabilities header with --accept-app-caps. I’d look at that only after the plain version works.
Step 5 of 8: Not everything is a web app
Serve can also forward raw TCP, which is how you reach something like SSH or RDP through the same mechanism. The docs describe two flavours: --tcp=port forwards the packets as they are, and --tls-terminated-tcp=port terminates TLS first and forwards what is inside.
tailscale serve --bg --tcp=2222 tcp://localhost:22
For SSH specifically, Tailscale has its own SSH feature, which I’d look at first, and I have a tip about it on this site. The TCP forwarder is for the odd service that has no Tailscale-aware option.
If a backend needs the real client address, there is the PROXY protocol: --proxy-protocol=2 together with --tls-terminated-tcp hands the original source IP and port to the backend. The docs say most people will want version 2. It only works with a backend that expects the PROXY protocol, so check that first.
Step 6 of 8: Who can reach it: ACLs, tags and shares
Serve does not add its own access control. The same rules that decide whether your phone may talk to the server decide whether it may open the Serve address. If you have restricted devices or users in your policy file, those restrictions apply to every service you share this way. That is good news: you do not have a second list to maintain. The guide on tags and grants covers how to keep one device from reaching every container.
If you share a device with someone outside your tailnet, they can open the Serve address and the identity headers carry their own login. That is a feature if your app wants to know who is who, and a reason to think before you share a device that has Serve on it.
One more thing about names. HTTPS certificates get issued for your device name, and Unraid’s own docs warn that for a container name the certificate ends up in a public certificate ledger. The same logic applies to any device name you put an HTTPS certificate on, so give devices names you are happy to see in public.
Step 7 of 8: Funnel: the one to be careful with
Funnel is Serve for the public internet. Anyone with the link can open it, whether they use Tailscale or not. The traffic goes through Tailscale’s relay servers, which build an encrypted tunnel to your device. According to Tailscale, the relays do not decrypt it and your device’s address stays hidden. The command is the same shape:
tailscale funnel 3000
The Tailscale docs disagree with themselves on the default (the Funnel page says it is disabled until you enable it, the Serve page says it is on). Either way, the first tailscale funnel opens a consent page that creates certificates and adds a funnel node attribute to your policy file. By default that lets everyone in autogroup:member use it, so look at that policy line afterwards. The docs list the limits: only ports 443, 8443 and 10000, only TLS, only names under your tailnet’s domain, and bandwidth limits you cannot change.
The same port cannot be Serve and Funnel at once. Whichever command ran last wins: if the last one was serve the port is private, if it was funnel the port is public. I find that easy to forget, so I run tailscale funnel status before I walk away from a share.
Switching it off again is tailscale funnel reset for everything, or the original command with off for one share.
Funnel puts no login in front of your app. Whatever you share has to protect itself, and a service that was only ever meant for your tailnet is the wrong thing to hang on the public internet. I’d use Funnel for a thing that is meant to be public anyway, like a demo or a webhook receiver, for a limited time. For anything that holds personal data, keep it on Serve; that is a GDPR question I would rather not have to answer.
There is one real upside for Dutch home connections: Funnel needs no port forward at all, so it works when your provider puts you behind CGNAT and your router has nothing to open.

Step 8 of 8: When it does not work
- Serve says your tailnet is not set up for it. Follow the login-server URL it prints. That is the consent page for HTTPS.
- The address does not resolve from another device. Check that MagicDNS is on and that the other device is in the same tailnet.
- The page loads but the links are broken. The app does not like living on a path. Give it its own port with
--https=instead of--set-path. - Funnel refuses. The usual causes are a missing
funnelattribute in the policy file or HTTPS not being enabled. - The app shows “nobody” or an empty login. The request did not come through Serve (a direct call, a tagged device, or Funnel). Test the route with the little Python server above.
Funnel asks for new certificates when it is set up. The docs warn that doing this over and over can hit Let’s Encrypt’s rate limits, and then you wait for about 34 hours. So do not script a create-and-destroy loop around it while you are testing.
For related setups on this site: why a device disappears after 180 days matters here too, because a shared service on an expired node goes away with it.

