Note: I am using caddy-docker-proxy to automatically update a Caddy configuration from docker labels (à la Traefik). This does not change, I believe, the question because it essentially boils down to using separate Caddyfiles per service.
The documentation shows how to use wildcard certificated, by enveloping entries in an *.example.com block
I would like to use wildcards but in separate Caddyfiles.
I imagine that I could add a tls load directive for each entry, but this would require the certificate to be maintained (requested, refreshed) without an associated endpoint. In other words, something should periodically download a wildcard certificate and place it in a specific place (and that’s all).
Is this possible?
EDIT ONE: looks like it is via the JSON endoint. Can that be translated back to Caddyfile “code”?
EDIT TWO: I already asked that question back in 2021… The answer was “it has to be done via the API”
I will have to find a way to manage this in a docker environment (any ideas welcome)
In a future version we’ll introduce a new option which would make it possible:
CDP doesn’t act like separate files, no. It’s one big Caddyfile. It doesn’t use import to bring in other files or w/e.
I’m pretty sure CDP would allow you to merge labels for a site with the same address. If you define *.example.com as your site address in each container, they should get zipped up. Just put the host matcher & handle labels inside of that, on each container.