How do I connect Caddy to Jellyfin in Docker?

0
0
Asked By MellowPine47 On

I'm trying to use Caddy as a reverse proxy for Jellyfin, but requests never reach the Jellyfin page. My Caddy container publishes ports 80 and 443 and mounts its configuration, data, and site directories. The Caddyfile currently contains:

jellyfin.local {
reverse_proxy jellyfin:8096
}

I also tried using localhost:8096 as the upstream, but neither HTTP nor HTTPS works in the browser. Caddy appears to be reading the Caddyfile because the changes show up in its autosave.json, so I'm unsure whether the problem is Docker networking, hostname resolution, or the local domain itself. I eventually want to configure several reverse proxies, but I'm trying to get Jellyfin working first.

3 Answers

Answered By QuietMaple22 On

`localhost:8096` will not point to Jellyfin from inside the Caddy container. In that context, localhost means the Caddy container itself. Use `jellyfin:8096` after placing both containers on the shared network. Also make sure `jellyfin.local` resolves on the client machine to the Docker host’s IP, using local DNS or a hosts-file entry. You can test the upstream directly with `docker exec caddy curl -v http://jellyfin:8096`.

Answered By CopperLynx5 On

For a local-only name, explicitly use HTTP first so certificate provisioning is not another variable:

http://jellyfin.local {
reverse_proxy jellyfin:8096
}

Once networking and name resolution work, you can decide whether to use Caddy’s internal certificates or a real domain. If you keep HTTPS enabled locally, the browser may warn because the certificate is not trusted until you install the local CA certificate.

NorthWindLark3 -

The hostname has two separate jobs here: the browser must resolve `jellyfin.local` to the Docker host, while Caddy must resolve `jellyfin` to the Jellyfin container. Fixing only one of those will still leave the proxy unusable.

Answered By OrbitSparrow8 On

Caddy and Jellyfin need to share a Docker network. The hostname `jellyfin` is resolved through Docker’s internal DNS, but that only works when both containers are attached to the same network. You can create a shared external network and attach each stack to it, rather than putting every service into one huge Compose file.

For example, create the network once with `docker network create proxy`, then add this to both Compose files:

networks:
proxy:
external: true

Attach both services to it with `networks: - proxy`. You generally only need to publish ports 80 and 443 from Caddy; Jellyfin does not need to expose its port to the host.

MellowPine47 -

I didn’t realize separate Compose files could use the same network. I’ve been putting everything into one compose file, so I’ll try the external network approach.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.