Hi everyone 馃槃
I cannot work out for the life of me where the syntax error/mistake is in my caddyfile. Can anyone see it? Thanks everyone.
{
email [email protected]
ca https://acme-staging-v02.api.letsencrypt.org/directory
admin off
}
example.com {
header {
X-Content-Type-Options nosniff
X-Frame-Options DENY
Referrer-Policy no-referrer-when-downgrade
}
reverse_proxy example:10000
}
example.com {
redir https://example.com
}
Thanks for your question, and we're thrilled that you're using Caddy! This looks more like a question about how to use Caddy rather than a bug report or feature request. Since this issue tracker is reserved for actionable development items, I'm going to close this, but we have a community forum where more people will be exposed to your question, including people who may be more expert or experienced with the specific question you're facing. I hope you'll ask your question there, and thanks for understanding!
Why doesn't Caddy show which directive isn't recognised?
You redacted parts of your Caddyfile so we can't properly replicate your issue. Please ask on the forums and fill out the thread template so we can fully understand what's going on.
As a first step, the global option ca is invalid, it's acme_ca. See https://caddyserver.com/docs/caddyfile/options
Ok thanks @francislavoie
I tried acme_ca as well.
@dbrennand , I just used your Caddyfile locally to test (with modification, i.e. remove duplicate hostname and change domain to localhost). Caddy says exactly which directive is unrecognized:
run: adapting config using caddyfile: unrecognized parameter name: ca
The directive you're looking for is acme_ca. It's listed in the Global options section.
I have the following config now. Still experiencing the same error:
I am using container image: caddy:2.0.0-alpine
run: adapting config using caddyfile: /etc/caddy/Caddyfile:2: unrecognized directive:
{
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
admin off
email [email protected]
}
example.com {
header {
X-Content-Type-Options nosniff
X-Frame-Options DENY
Referrer-Policy no-referrer-when-downgrade
}
reverse_proxy exampleservicename:10000
}
www.example.com {
redir https://example.com
}
That config as given adapts and validates correctly. You must not have your docker volume set up correctly.
I am using a bind mount to mount the Caddyfile to the container.
From docker-compose.yml
...
caddy:
image: "caddy:2.0.0-alpine"
container_name: "caddy"
ports:
- "80:80"
- "443:443"
networks:
- "frontend"
- "backend"
volumes:
# Persistent data in the caddydata directory
- "./caddydata:/data"
# Mount Caddyfile
- "./Caddyfile:/etc/caddy/Caddyfile"
Do docker-compose exec caddy /bin/sh -c 'cat /etc/caddy/Caddyfile', does it look right?
The container exists immediately so I cannot run the command in time馃槥
Run:
docker-compose run caddy /bin/sh -c 'cat /etc/caddy/Caddyfile'
Hey guys,
Really appreciate all the help you have provided 馃憤
I was using git bash to create an SSH session to the host I was using. Not really sure what caused the issue but when switching to another terminal and running cat on the file I could see the output was completely messed up 馃槚

Re-created the file and all is well. Many thanks for all your help once again! 鉂わ笍
EDIT: It's strange. When using vim in git bash the file looks perfectly normal 馃槚
@francislavoie whitespace!! 馃槃
Most helpful comment
Hey guys,
Really appreciate all the help you have provided 馃憤
I was using git bash to create an SSH session to the host I was using. Not really sure what caused the issue but when switching to another terminal and running

caton the file I could see the output was completely messed up 馃槚Re-created the file and all is well. Many thanks for all your help once again! 鉂わ笍
EDIT: It's strange. When using vim in git bash the file looks perfectly normal 馃槚