1. My Caddy version (caddy -version
):
v2.0.0-beta12 h1:LZnXOGDr1SbeJNyln8Xc/hXjWCa/a9qFpCbWt2iwJPw=
2. How I run Caddy:
a. System environment:
MacOS 10.15.1
b. Command:
./caddy adapt --config ./static/root/etc/Caddyfile --pretty
c. Service/unit/compose file:
N/A
d. My complete Caddyfile:
{env.APP_DOMAIN} {
matcher all {
path /
}
matcher all-excluding-local-files {
path /
not {
path /css /fonts /images /js /favicon.ico /robots.txt
}
}
encode match:all {
gzip
}
tls {env.ACME_CA_EMAIL} {
ca https://acme-staging-v02.api.letsencrypt.org/directory
dns route53
}
header match:all {
Content-Security-Policy "frame-ancestors 'none'"
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
X-XSS-Protection "1; mode=block"
}
proxy match:all app:4000 {
except /css /fonts /images /js /favicon.ico /robots.txt /default.html
transparent
}
file_server * {
root /www
}
}
3. The problem I’m having:
I’m trying to convert a Caddyfile from v1 to v2. I’m having problems with the TLS part.
4. Error messages and/or full log output:
adapt: parsing caddyfile tokens for ‘tls’: Caddyfile:20 - Error during parsing: unknown subdirective: dns
5. What I already tried:
I tried moving the tls
directive out of the server scope…
tls {env.ACME_CA_EMAIL} {
ca https://acme-staging-v02.api.letsencrypt.org/directory
dns route53
}
{env.APP_DOMAIN} {
...
and received adapt: Caddyfile:2: unrecognized directive: ca
.
I also tried
{
tls {env.ACME_CA_EMAIL} {
ca https://acme-staging-v02.api.letsencrypt.org/directory
dns route53
}
}
{env.APP_DOMAIN} {
...
and received adapt: unrecognized parameter name: tls
.
I had a good read through Home · caddyserver/caddy Wiki · GitHub and JSON Config Structure - Caddy Documentation and noticed that the tls directive is missing from apps
and seems to be moved up to the top level. But only the JSON is documented for this, I can’t find out how to write this in Caddyfile format.
Is this possible? Will this be possible?
In the meantime, do I need to move to JSON configuration to be able to do these things?