1. The problem I’m having:
Caddy as a reverse proxy is not working as expected since an update from 2.7.6 > 2.8.4. I changed nothing aside from updating, and I’m having trouble figuring out what is wrong.
I checked the 2.8 breaking changes on github and noticed mention of ZeroSSL now requiring an email, which I previously did not have in my Caddyfile. However, I tried adding my email and still couldn’t get things working, so either it’s unrelated or I added the email wrong.
2. Error messages and/or full log output:
Here is the output of the docker logs:
docker logs --tail 50 --follow --timestamps caddy-caddy-1
2024-07-22T17:43:51.334969727Z {"level":"info","ts":1721670231.3348753,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-07-22T17:43:51.335775857Z {"level":"info","ts":1721670231.3356664,"msg":"adapted config to JSON","adapter":"caddyfile"}
2024-07-22T17:43:51.336441047Z {"level":"info","ts":1721670231.3363712,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
2024-07-22T17:43:51.336582644Z {"level":"info","ts":1721670231.3365228,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
2024-07-22T17:43:51.336592050Z {"level":"info","ts":1721670231.3365357,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
2024-07-22T17:43:51.336635221Z {"level":"info","ts":1721670231.336594,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000053300"}
2024-07-22T17:43:51.336853709Z {"level":"info","ts":1721670231.3368046,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
2024-07-22T17:43:51.336896507Z {"level":"info","ts":1721670231.336856,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details."}
2024-07-22T17:43:51.336997286Z {"level":"info","ts":1721670231.3369484,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
2024-07-22T17:43:51.337023984Z {"level":"info","ts":1721670231.3369994,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
2024-07-22T17:43:51.337035359Z {"level":"info","ts":1721670231.3370214,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["jellyseerr.kalen.io","jellyfin.kalen.io"]}
2024-07-22T17:43:51.346763472Z {"level":"info","ts":1721670231.346683,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
2024-07-22T17:43:51.346832500Z {"level":"info","ts":1721670231.3468037,"msg":"serving initial configuration"}
2024-07-22T17:43:51.363992001Z {"level":"info","ts":1721670231.363879,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"62f5e115-7928-43da-8192-ce377c853b1d","try_again":1721756631.3638766,"try_again_in":86399.999999723}
2024-07-22T17:43:51.364017971Z {"level":"info","ts":1721670231.3639472,"logger":"tls","msg":"finished cleaning storage units"}
When adding ‘debug’ mode to the CaddyFile, no further useful information is given because I get the below error. I’m assuming due to bad syntax? Please advise how to properly enable debug in the global options.
{
debug
}
{
acme_dns cloudflare API_TOKEN_HERE
}
jellyfin.kalen.io {
reverse_proxy 192.168.1.101:8096
}
jellyseerr.kalen.io {
reverse_proxy 192.168.1.101:5055
}
2024-07-22T17:47:50.226760822Z {"level":"info","ts":1721670470.2266097,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-07-22T17:47:50.226785414Z Error: adapting config using caddyfile: server block without any key is global configuration, and if used, it must be first
2024-07-22T17:47:51.153377011Z {"level":"info","ts":1721670471.1532276,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-07-22T17:47:51.153400704Z Error: adapting config using caddyfile: server block without any key is global configuration, and if used, it must be first
2024-07-22T17:47:52.230445426Z {"level":"info","ts":1721670472.2303288,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-07-22T17:47:52.230521176Z Error: adapting config using caddyfile: server block without any key is global configuration, and if used, it must be first
2024-07-22T17:47:53.346945691Z {"level":"info","ts":1721670473.3468075,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-07-22T17:47:53.346978813Z Error: adapting config using caddyfile: server block without any key is global configuration, and if used, it must be first
3. Caddy version:
2.7.6-alpine (Docker) upgraded to 2.8.4-alpine (Docker)
4. How I installed and ran Caddy:
a. System environment:
OS: Debian 12
Architecture: x86_64
Kernel: 6.1.0-23
Docker version 27.0.3, build 7d4bcd8
b. Command:
I created the docker container using an image built from a Dockerfile. Here is the content of my Dockerfile:
FROM caddy:2.8.4-builder-alpine AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
FROM caddy:2.8.4
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
c. Service/unit/compose file:
This is the docker-compose.yml I ran after building the Dockerfile image:
services:
caddy:
image: caddy:2.8.4-alpine
build: .
security_opt:
- label:disable
- no-new-privileges:true
restart: unless-stopped
environment:
- PUID=3000
- PGID=3000
volumes:
- /home/kalen/caddy/Caddyfile:/etc/caddy/Caddyfile
- caddy-data:/data
- caddy-config:/config
ports:
- 80:80
- 443:443
volumes:
caddy-data:
caddy-config:
d. My complete Caddy config:
{
acme_dns cloudflare API_TOKEN_HERE
}
jellyfin.kalen.io {
reverse_proxy 192.168.1.101:8096
}
jellyseerr.kalen.io {
reverse_proxy 192.168.1.101:5055
}
Thanks!