If you open Jellyfin from outside your home at http://<your-ip>:8096, your password and everything
you watch cross the internet unencrypted. This guide gives it a proper address, like
https://yourname.duckdns.org, with a padlock, using Caddy and a free
Let's Encrypt certificate.
Want the finished files? See my server's setup on GitHub (opens in a new tab)
Caddy is a reverse proxy: a program that receives every visitor's request, handles the encryption, and passes the request on to Jellyfin inside the server. It also gets the certificate and renews it by itself. What a certificate is and who does what is in How HTTPS certificates work.
My own server uses its own domain in AWS's Route 53, kept on my home IP by a small updater container. This guide uses the free DuckDNS instead, so you need no domain and no AWS account; the rest works the same way. How I set up mine is in Putting Jellyfin behind HTTPS with Caddy and Let's Encrypt.
Tailscale or this guide?
First, consider Tailscale. Tailscale is an app that links your devices into a private network wherever they are. Install it on the server and on each device that watches, and Jellyfin is reachable from anywhere, encrypted, without opening anything on your router. It's simpler and safer than this guide. Its cost is that everyone you share with must install the app and accept an invitation, and it can't be installed on many smart TVs.
This guide does the opposite: Jellyfin gets a public address that anyone you share with can open in a browser or any Jellyfin app, with nothing to install. In exchange, it's more work, and Jellyfin's sign-in page is on the open internet.
| Tailscale | This guide (Caddy and HTTPS) | |
|---|---|---|
| What viewers need | The Tailscale app and an invitation | Just the address |
| Who can reach Jellyfin | Only devices on your Tailscale network | Anyone on the internet, who then needs a password |
| Router changes | None | Forward ports 80 and 443 |
| Setup | A few minutes | An hour or so: a name, the router, Caddy |
| Behind CGNAT (Before you start) | Works | Doesn't work |
If Tailscale suits the people you share with, use it and stop here. Otherwise, read on.
How it fits together
flowchart TD
Phone["Phone or laptop<br/>away from home"] -- "https://yourname.duckdns.org,<br/>encrypted" --> Router
subgraph home["Your home"]
Router["Router<br/>forwards 80 and 443"] --> Caddy
subgraph server["The server"]
Caddy["Caddy<br/>HTTPS"] -- "plain HTTP" --> Jellyfin["Jellyfin<br/>:8096"]
DuckDNS["duckdns<br/>keeps the name<br/>on your home IP"]
end
end
Before you start
- Jellyfin running in Docker Compose on a Linux server, and working at home on port 8096. The examples assume Ubuntu.
- Access to your router's settings.
- A public IP address of your own. Some internet providers share one address between many homes
(CGNAT), and then nothing outside can reach you. Compare the outside (WAN) address on your
router's status page with what the server shows for
curl ifconfig.me. If they differ, stop here and use Tailscale instead.
When a command or file contains yourname, use your own name.
1. Get a name for your home
Let's Encrypt only issues certificates for names, not IP addresses, so your home needs one.
DuckDNS gives one away free: sign in, add a subdomain (the yourname in
yourname.duckdns.org), and copy the token at the top of the page.
Use DuckDNS rather than the free name some routers offer (TP-Link's tplinkdns.com, for example).
With your own domain instead, add an A record (not a CNAME) holding your home IP, and keep it current with your DNS provider's dynamic DNS tool.
2. Keep the name on your home IP
Your provider can change your home IP at any time. A small container updates DuckDNS every five
minutes. Add it to Jellyfin's compose.yaml, under services::
duckdns:
image: lscr.io/linuxserver/duckdns:latest
container_name: duckdns
environment:
- SUBDOMAINS=yourname
- TOKEN=<your token>
- TZ=America/Toronto
restart: unless-stopped
Start it with sudo docker compose up -d duckdns, then check that the two lines below show the same
address (the first asks Google's DNS, not your router):
dig +short yourname.duckdns.org @8.8.8.8
curl ifconfig.me
With your own domain in Route 53, my server's dns-updater does this job instead of the duckdns container.
3. Forward ports 80 and 443
On your router, give the server a fixed address on your network (often called a DHCP reservation),
then forward TCP ports 80 and 443 to it. Port 443 carries HTTPS. Port 80 is where Let's
Encrypt checks that you control the name, and where Caddy turns plain http:// visits into
https://.
If the server runs a firewall, open them there too:
sudo ufw allow 80,443/tcp
4. Free ports 80 and 443 on the server
Caddy can't start while another program holds either port. Check:
sudo ss -tlnp '( sport = :80 or sport = :443 )' # should list nothing
If something is listed, stop it. For Apache, for example:
sudo systemctl disable --now apache2
5. Add Caddy
Create a file named Caddyfile next to compose.yaml. This is all of it:
yourname.duckdns.org {
reverse_proxy localhost:8096
}
Naming the site is all the HTTPS setup there is. From that, Caddy gets a certificate, renews it
before it expires, and redirects plain HTTP to HTTPS. My server's
Caddyfile is the
same, plus a www. redirect.
Then add Caddy to compose.yaml:
caddy:
image: caddy:2.11
container_name: caddy
network_mode: host
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./caddy/data:/data
- ./caddy/config:/config
depends_on:
- jellyfin
restart: unless-stopped
network_mode: hostlets Caddy use the server's own ports 80 and 443 and reach Jellyfin atlocalhost:8096. Use it when Jellyfin's service hasnetwork_mode: hosttoo../caddy/datamust be kept. It holds the certificates. Without it, every restart asks Let's Encrypt for new ones, and you soon hit its limits.
If your Jellyfin service publishes ports (ports: - 8096:8096) instead of using the host network,
give Caddy ports too and point it at Jellyfin by its service name:
caddy:
image: caddy:2.11
container_name: caddy
ports:
- 80:80
- 443:443
# volumes, depends_on and restart as above
yourname.duckdns.org {
reverse_proxy jellyfin:8096
}
6. Start Caddy and watch for the certificate
sudo docker compose up -d caddy
sudo docker logs -f caddy # Ctrl+C to stop watching
Within a minute you should see certificate obtained successfully.
7. Test from outside
Turn off Wi-Fi on your phone and open https://yourname.duckdns.org over mobile data. You should
see Jellyfin's sign-in page with a padlock. Test from outside, not at home, to see what the
people you share with will see.
In the Jellyfin apps, the server address is now https://yourname.duckdns.org, with no port.
8. Tell Jellyfin about Caddy
Every request now reaches Jellyfin from Caddy, on the same server, so Jellyfin thinks every viewer
is at home. That changes which bitrate limits apply, and which address it records for a failed
sign-in. In Jellyfin, open Dashboard > Networking, put 127.0.0.1 in Known proxies (with
published ports, Caddy's service name, caddy), save, and restart Jellyfin.

Leave the HTTPS Settings below it off and empty: Caddy handles HTTPS, and Jellyfin keeps serving plain HTTP to it.
Optionally, tell Jellyfin its new address, so it gives that one to apps. In the Jellyfin service in
compose.yaml:
environment:
- JELLYFIN_PublishedServerUrl=https://yourname.duckdns.org
9. Close the old door
Once everyone you share with uses the new address, remove the router's forward for port 8096. From then on, the only way in from outside is through Caddy.
What this doesn't do
- Jellyfin is still on the internet. HTTPS stops eavesdropping, not someone guessing passwords at the sign-in page, so give every account a strong one.
- Your name points at your home. Anyone who looks it up gets your home IP.
- It goes down with your house. A power or internet cut takes it offline, and nothing tells you.
If the first two matter more to you than an address anyone can open, use Tailscale instead (see the comparison at the top).
If you'd rather not assemble it yourself, home-media-server sets up Jellyfin, Caddy and DuckDNS together; see the setup guide.
