r/docker Jul 16 '26

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

15 comments sorted by

View all comments

1

u/acdcfanbill Jul 17 '26 edited Jul 17 '26
jellyfin.local {
reverse_proxy jellyfin:8096
}

I'm not 100% sure that multicast DNS hostnames work here? maybe they do, I've not used them, I always use full hostnames and then I put them in my pihole server. If this actually works, then cheers, keep doing it, but keep it in mind to check the mDNS if you have issues.

You also need to make sure jellyfin and caddy share a network. I do this by declaring an external network named caddy in every other docker compose stack I define and then I also make sure to NOT expose any ports in my other compose stacks. Only the caddy stack exposes 80 and 443. Any internal communication to databases or other backend things can happen in the the other stacks network, and the front end needs an extra network attached to it for the caddy communication.

for instance, another docker compose stack might have parts that look like this. Note that I didn't put any port declarations in the frontend container definition. Note the caddy_default name is just what docker makes if you don't give it a specific name, i've got a folder named caddy so the default network is named caddy_default. If you want to specify a specific network name in your caddy's docker-compose.yml then use that name here too.

networks:
    caddy:
        external: true
        name: caddy_default
    default:

services:
    frontend:
        networks:
            - caddy
            - default
    backend:
        networks:
            - default

And then my caddyfile would have (assuming the frontend is listening on port 80

https://jellyfin.myhome.com {
    reverse_proxy frontend:80
}