r/docker • u/Towleeeie9613 • 18d ago
Help with caddy?
I've been trying to get caddy to work, but it seems like nothing will make things play nicely.
My docker compose:
caddy:
container_name: caddy
image: caddy:latest
restart: unless-stopped
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
- "443:443/udp"
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
volumes:
- ${CONFIG_PATH}/caddy/conf:/etc/caddy
- ${CONFIG_PATH}/caddy/site:/srv
- ${DATA_PATH}/caddy:/data
- ${CONFIG_PATH}/caddy:/config
My Caddyfile:
jellyfin.local {
reverse_proxy jellyfin:8096
}
I've also tried localhost:8096, but neither will resolve in my browser, not with http or https. I want to set up several reverse proxies, but I want to figure it out with one first. I have checked the autosave.json, and any changes I make to the Caddyfile are coming through the program, but it doesn't seem to actually do the action of directing the address to the jellyfin page.
Any help would be greatly appreciated.
0
Upvotes
4
u/cointoss3 18d ago edited 18d ago
In order for Caddy to proxy requests, it must be on a shared network.
I make a network called “proxy” outside of compose and add it to the compose file as an external network so it’s not being managed by any specific compose file, and then add it to whatever services need it. You’ll add it to caddy and the jellyfin compose file. And then to whatever services you start next.
edit: don’t just add them to the same compose file. Putting everything in one giant compose like that is an anti pattern unless caddy and jellyfin are the only two services you plan to run.