I’m currently setting up Caddy to manage SSL certificates for my domain, and I’ve encountered an issue where Caddy is issuing separate SSL certificates for each subdomain, despite having a wildcard certificate.
2. Caddy version:
v2.8.4
3. How I installed and ran Caddy:
Caddy Docker Container
a. System environment:
OS - Ubuntu
Architecture - arm64
Docker version 27.1.1, build 6312585
My expectation was that Caddy would only issue certificates for domain.tld and *.domain.tld, and that the wildcard certificate would cover all subdomains like webdav.domain.tld and logs.domain.tld. Doesn’t caddy check if already existing cert covers the newer site block ?
How can I configure Caddy to reuse the wildcard certificate for all subdomains and avoid issuing separate certificates for specific subdomain ?
Apart from this, i would also like to know how to know if caddy supports Multi SAN certificate. Say a single ssl cert which is valid for both *.adguard.domain.tld & adguard.domain.tld ?
Caddy doesn’t check this, no. You can think of each site block kinda like its own little island, unaffected by the other sites except for global options.
In the Caddyfile, your only option to assign site configuration to a wildcard certificate is to literally put that configuration in a wildcard site block.
It’s possible to differentiate hosts under a wildcard site with a host matcher, e.g.:
Thanks for the heads up. AdGuard Home is the only service i know which needs a Multi SAN cert, just to confirm the syntax for it specifically
*.adguard.domain.tld, adguard.domain.tld {
tls /path/to/your/certificate.crt /path/to/your/private.key
... other directives as needed
}
Is the above correct or i need something else too ?
I want to confirm that if I use an imported Multi-SAN certificate that matches my site addresses, Caddy won’t attempt to issue its own certificate. While it’s clear that Caddy doesn’t support Multi-SAN certificates directly, my concern is whether Caddy will at least recognize that the certificate is Multi-SAN and covers both site addresses. I wish there was an auto-https directive that could be applied to specific site blocks to control this behavior more precisely.
Caddy won’t attempt to issue its own certificate for any site block you import your own cert for. Using the tls <cert> <key> syntax creates a manual SNI certificate selection association for that specific cert for all the site addresses you’ve specified for that site block. Caddy ignores everything else; doesn’t matter if you specify the wrong certificate, if the cert has one name or fifty names or is out of date, Caddy will load it and serve it for requests to that site, as you’ve configured. That can create its own footguns sometimes, but there’s definitely no need to worry about Caddy ignoring your directive and automating a cert anyway.