1. My Caddy version (caddy version
):
$ caddy version
v2.0.0-rc.3 h1:z2H/QnaRscip6aZJxwTbghu3zhC88Vo8l/K57WUce4Q=
2. How I run Caddy:
a. System environment:
$ uname -a
Linux 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ systemd --version
systemd 237
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid
b. Command:
c. Service/unit/compose file:
radd.service in systemd:
[Unit]
Description=Radd Web Server
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=caddy
Group=caddy
Restart=on-failure
ExecStart=/usr/bin/caddy run --config /etc/caddy/Raddfile --environ
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Raddfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
#ProtectHome=true // TODO try enabling this
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
/etc/caddy/Raddfile:
https://192.168.196.249 {
bind 192.168.196.249
tls internal
log {
output file /var/log/caddy/ctrl_access.log
format single_field common_log
}
encode gzip zstd
handle /spi/* {
reverse_proxy localhost:8224
}
handle {
root * /var/www/ctrl
try_files {path} /index.html
file_server
}
}
3. The problem Iâm having:
Iâm trying to run 2 instances of Caddy. This is the one Iâm tinkering with and donât want to disturb the one that is running alpha-production. But this 2nd instance fails with an error. I tried stopping the other instance, but it made no difference.
This instance is bound to a certain vpn network interface with a private IP addr and wonât be exposed to the internet. Iâm trying to use the internal CA to get https to work.
4. Error messages and/or full log output:
This error msg seems to be the issue:
Apr 16 21:27:16 caddy[31029]: run: loading initial config: decoding request body: invalid character 'h' looking for beginning of value
Full output via journald:
Apr 16 21:27:16 systemd[1]: Started Radd Web Server.
Apr 16 21:27:16 caddy[31029]: caddy.HomeDir=/var/lib/caddy
Apr 16 21:27:16 caddy[31029]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Apr 16 21:27:16 caddy[31029]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Apr 16 21:27:16 caddy[31029]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Apr 16 21:27:16 caddy[31029]: runtime.GOOS=linux
Apr 16 21:27:16 caddy[31029]: runtime.GOARCH=amd64
Apr 16 21:27:16 caddy[31029]: runtime.Compiler=gc
Apr 16 21:27:16 caddy[31029]: runtime.NumCPU=1
Apr 16 21:27:16 caddy[31029]: runtime.GOMAXPROCS=1
Apr 16 21:27:16 caddy[31029]: runtime.Version=go1.14.2
Apr 16 21:27:16 caddy[31029]: os.Getwd=/
Apr 16 21:27:16 caddy[31029]: LANG=C
Apr 16 21:27:16 caddy[31029]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Apr 16 21:27:16 caddy[31029]: HOME=/var/lib/caddy
Apr 16 21:27:16 caddy[31029]: LOGNAME=caddy
Apr 16 21:27:16 caddy[31029]: USER=caddy
Apr 16 21:27:16 caddy[31029]: INVOCATION_ID=f92ae758769a4b27beead6703c12174a
Apr 16 21:27:16 caddy[31029]: JOURNAL_STREAM=9:359724
Apr 16 21:27:16 caddy[31029]: {"level":"info","ts":1587072436.8639393,"msg":"using provided configuration","config_file":"/etc/caddy/Raddfile","config_adapter":""}
Apr 16 21:27:16 caddy[31029]: run: loading initial config: decoding request body: invalid character 'h' looking for beginning of value
Apr 16 21:27:16 systemd[1]: radd.service: Main process exited, code=exited, status=1/FAILURE
Apr 16 21:27:16 systemd[1]: radd.service: Failed with result 'exit-code'.
5. What I already tried:
Iâve tried re-writing the Caddyfile several times, it always complains about the first thing in the file, even if it is a â#â. All I did was put a comment as the top line of the file.
Apr 16 21:22:33 caddy[30618]: run: loading initial config: decoding request body: invalid character '#' looking for beginning of value
If I take out the https://' and give it a numeric address e.g.
192.168.196.249 {` it still fails:
Apr 16 21:23:33 caddy[30714]: run: loading initial config: decoding request body: invalid character '.' after top-level value
There is obviously some some really dumb mistake in my Caddyfile, but I just canât seem to see it. Any help appreciated.