1. Caddy version (caddy version
):
The docker image “caddy:2.1.1-alpine”
2. How I run Caddy:
In a docker managed by DC/OS
a. System environment:
Docker 19.03.8
Whatever version of alpine linux the caddy:2.1.1 docker image uses.
b. Command:
The docker command is being constructed for me by DC/OS but it would look something like this:
docker run -v /distributed_file_system/automated_testing/caddy.json:/etc/caddy/Caddyfile -v /distributed_file_system/automated_testing/certs:/root/.caddy -p 8443:8443 caddy:2.1.1-alpine
c. Service/unit/compose file:
I’m not sure what you mean by this.
d. My complete Caddyfile or JSON config:
{
"apps": {
"http": {
"servers": {
"example": {
"listen": [":8443"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "It worked this time"
}]
}
]
}
}
}
}
}
3. The problem I’m having:
There are two questions I couldn’t figure out reading the documentation.
The first is whether or not it is possible when using the docker image to mount in a .json file rather than a Caddyfile. The first error message described below are what happen when I tried to do so. If so, how? Generally speaking, if the Caddyfile is going to be converted into json and the json is more fully featured, I’d prefer to use json to begin with. As a stop gap, I could hit the /load endpoint with the json but I’d really like for the json to be automatically be loaded each time dcos runs the service as opposed to relying on some external script to load it in.
The second question is whether or not it’s possible to disable client authentication. The only thing I found when looking around for answers earlier suggested that I ought to switch TLS to on_demand and a link was given to how one would do this in the json configuration (but not in the Caddyfile). Ultimately, what I would like is for unauthenticated clients to hit my proxy and have their request be passed onwards with the certificates I provide for them added (which are mounted into the docker image via the command above).
4. Error messages and/or full log output:
This is an output of attempting to run the docker while mounting in the caddy.json shown above.
run: adapting config using caddyfile: /etc/caddy/Caddyfile:2: unrecognized global option: apps
I0817 12:16:37.703112 8080 executor.cpp:736] Container exited with status 1
This is an output of when I switched to a Caddyfile and attempted to hit the server with an unauthenticated client. (on the client end I get ‘curl: (35) Peer reports it experienced an internal error’)
[automated-testsautomated-test-proxy.marathon.l4lb.thisdcos.directory] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up A for automated-testsautomated-test-proxy.marathon.l4lb.thisdcos.directory - check that a DNS record exists for this domain, url:
- retrying in 2m0s (1m33.017635556s/720h0m0s elapsed)...
5. What I already tried:
I tried reading the documentation, the docker image README, and doing web searches. I have no reason to believe that anything is behaving in a fashion other than how it’s intended I’m just having troubles finding information on how to do as I wish.