1. Caddy version (caddy version
):
v2.5.2
2. How I run Caddy:
a. System environment:
Debian Bullseye
b. Command:
systemctl start caddy
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
(nested) {
header server pseudo
}
(problem) {
import nested
reverse_proxy {args.0}
}
(serve) {
handle {
import problem {args.0}
}
}
www.example.com {
import serve 10.10.10.10:8080
}
3. The problem Iām having:
The above Caddyfile only validates when the āimport nestedā line is commented out, or when the handle block is stripped from (serve). I would like to find out if this is by design, or due to a bug that affects nesting.
4. Error messages and/or full log output:
validate: adapting config using caddyfile: parsing caddyfile tokens for āhandleā: Caddyfile:13 - Error during parsing: unrecognized directive: import - are you sure your Caddyfile structure (nesting and braces) is correct?
5. What I already tried:
I have reduced a very complex Caddyfile to the crux of the issue.