I just installed the latest version of Caddy via pkg (now that it's updated to 2.x) but the pkg'ed version won't start with the above error.
A manual download of 2.1.1 from the Caddy website works fine with the same Caddyfile, this appears to be an issue caused by building with Go 1.15 (https://github.com/lucas-clemente/quic-go/issues/2614).
# manual download version from caddyserver.com
root@vps:~ # /usr/local/bin/caddy2 version
# pkg-installed version
root@vps:~ # pkg info | grep caddy
caddy-2.1.1_1 Fast, cross-platform HTTP/2 web server with automatic HTTPS
root@vps:~ # /usr/local/bin/caddy version
panic: qtls.ClientSessionState not compatible with tls.ClientSessionState
goroutine 1 [running]:
(In reply to Gavin from comment #0)
thank you for your feedback. This is a known issue caused by quic-go not being prepared to be compiled with Go 1.15. This will be solved once Caddy is updated to 2.2 which will contain an updated version of quic-go that is compatible with Go 1.15. In the meantime you can try to compile Caddy yourself with Go 1.14 or use Caddy 2.1.1 which is compiled with Go 1.14.
This is the Github issue for the update for quic-go:
Also just updating quic-go to a newer release is not that straightforward as build fails with:
vendor/github.com/lucas-clemente/quic-go/internal/qtls/qtls.go:120:3: unknown field 'GetAppDataForSessionState' in struct literal of type qtls.Config
vendor/github.com/lucas-clemente/quic-go/internal/qtls/qtls.go:121:3: unknown field 'SetAppDataFromSessionState' in struct literal of type qtls.Config