1. Output of caddy version
:
latest caddy docker image as of this post
2. How I run Caddy:
Docker
a. System environment:
Arch, main docker image, through compose
b. Command:
docker-compose up -d
c. Service/unit/compose file:
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ${FOLDER_FOR_CONFIGS:?err}/caddy/Caddyfile:/etc/caddy/Caddyfile
- ${FOLDER_FOR_CONFIGS:?err}/caddy/data:/data
- ${FOLDER_FOR_CONFIGS:?err}/config:/config
- /mnt/vps/var/lib/caddy:/vps-caddy
d. My complete Caddy config:
vars { lcl "172.17.0.1" edn "home.monke.fail" evip "10.33.7.1" } # Globals
{ debug true log { level debug output file /data/caddy.log { roll_size 10mb roll_keep 10
roll_keep_for 720h } } storage file_system /vps-caddy/.local/share/caddy } home.monke.fail, *.home.monke.fail { } test.home.monke.fail { respond "we hit the server!! must be a services issue" } jellyfin.home.monke.fail {
reverse_proxy 172.17.0.1:8096 { trusted_proxies 10.33.7.1 } } jellyseer.home.monke.fail { reverse_proxy 172.17.0.1:5055 {
trusted_proxies 10.33.7.1 } } lidarr.home.monke.fail { reverse_proxy {lcl}:8686 { trusted_proxies 10.33.7.1 } } bazarr.{edn} { reverse_proxy {lcl}:6767 {
trusted_proxies {evip} }
}
readarr.{edn} {
reverse_proxy {lcl}:8787 { trusted_proxies {evip} } }
sonarr.{edn} { reverse_proxy {lcl}:8989 {
trusted_proxies {evip} }
} prowlarr.{edn} {
reverse_proxy {lcl}:9696 { trusted_proxies {evip} } }
qb.{edn} { reverse_proxy {lcl}:8200 {
trusted_proxies {evip} } }
dashy.{edn} { reverse_proxy {lcl}:4000 {
trusted_proxies {evip} } }
dashboard.{edn} { reverse_proxy {lcl}:3000 {
trusted_proxies {evip} } }
3. The problem I’m having:
can’t use variables at all, I have tried calling them through {vars.lcl} and {lcl}
4. Error messages and/or full log output:
{"level":"info","ts":1671785710.7593482,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"} Error: adapting config using caddyfile: /etc/caddy/Caddyfile:2: unrecognized directive: lcl
5. What I already tried:
I have moved the vars block from the bottom to top to confirm I’m not blind and missing some closing braces, I have also looked at a GitHub issue in surrounding the lack of variables in Caddyfiles, which then finished (ish) with the implementation of variables in Caddyfiles. Matt responded with a use case for them which I am sure I’m sticking to.