1. The problem I’m having:
reload caddy stuck although configuration valid. Been trying to use on demand TLS to forward all www.example.com to example.com
2. Error messages and/or full log output:
> caddy validate --config /etc/caddy/Caddyfile
2025/08/31 11:11:39.451 INFO using config from file {"file": "/etc/caddy/Caddyfile"}
2025/08/31 11:11:39.454 INFO adapted config to JSON {"adapter": "caddyfile"}
2025/08/31 11:11:39.457 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2025/08/31 11:11:39.457 WARN http.auto_https server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {"server_name": "srv1", "http_port": 80}
2025/08/31 11:11:39.457 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0003b9a80"}
2025/08/31 11:11:39.458 INFO tls.cache.maintenance stopped background certificate maintenance {"cache": "0xc0003b9a80"}
2025/08/31 11:11:39.458 INFO http servers shutting down with eternal grace period
Valid configuration
> systemctl reload caddy
^C → It stuck!
3. Caddy version:
v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=
4. How I installed and ran Caddy:
a. System environment:
Linux 6.14.0-23-generic #23-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 23:02:20 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
b. Command:
caddy validate --config /etc/caddy/Caddyfile
systemctl reload caddy
d. My complete Caddy config:
{
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
on_demand_tls {
ask https://myserver.com/check
}
}
http:// {
redir https://{host} permanent
}
https:// {
tls {
on_demand
}
redir https://www.{host} permanent
}
5. Caddy logs
root@ubuntu:~# sudo systemctl stop caddy
root@ubuntu:~# sudo caddy run --config /etc/caddy/Caddyfile
2025/08/31 11:35:00.408 INFO maxprocs: Leaving GOMAXPROCS=1: CPU quota undefined
2025/08/31 11:35:00.409 INFO GOMEMLIMIT is updated {"package": "github.com/KimMachineGun/automemlimit/memlimit", "GOMEMLIMIT": 431931801, "previous": 9223372036854775807}
2025/08/31 11:35:00.409 INFO using config from file {"file": "/etc/caddy/Caddyfile"}
2025/08/31 11:35:00.411 INFO adapted config to JSON {"adapter": "caddyfile"}
2025/08/31 11:35:00.414 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2025/08/31 11:35:00.414 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2025/08/31 11:35:00.415 WARN http.auto_https server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {"server_name": "srv1", "http_port": 80}
2025/08/31 11:35:00.415 INFO http enabling HTTP/3 listener {"addr": ":443"}
2025/08/31 11:35:00.417 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0000e0200"}
2025/08/31 11:35:00.418 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2025/08/31 11:35:00.418 WARN http HTTP/2 skipped because it requires TLS {"network": "tcp", "addr": ":80"}
2025/08/31 11:35:00.419 WARN http HTTP/3 skipped because it requires TLS {"network": "tcp", "addr": ":80"}
2025/08/31 11:35:00.419 INFO http.log server running {"name": "srv1", "protocols": ["h1", "h2", "h3"]}
2025/08/31 11:35:00.420 INFO autosaved config (load with --resume flag) {"file": "/root/.config/caddy/autosave.json"}
2025/08/31 11:35:00.420 INFO serving initial configuration
2025/08/31 11:35:00.423 INFO tls cleaning storage unit {"storage": "FileStorage:/root/.local/share/caddy"}
2025/08/31 11:35:00.425 INFO tls finished cleaning storage units