1. The problem I’m having:
I have in the past just gotten a cert for every subdomain of a single fqdn.
like so which runs fine right now
(r53) {
log {
output stdout
format console
}
tls adomain.net@gmail.com {
dns route53 {
max_retries 10
}
}
}
(errors) {
handle_errors {
rewrite * /{http.error.status_code}.html
file_server
}
}
# Git Server
https://git.645.adomain.net {
import r53
reverse_proxy http://nadal.adomain.net:3000
}
# Home Assistant Server
https://ha.adomain.net, https://ha.645.adomain.net {
import r53
reverse_proxy /* hassos.645.adomain.net:8123
}
https://gateway.adomain.net, https://gateway.645.adomain.net {
import r53
reverse_proxy /* router.645.adomain.net:8080
}
https://docker.adomain.net, https://docker.645.adomain.net {
import r53
reverse_proxy /* http://nadal.adomain.net:9016
}
But if I can use a single wildcard cert for multiple subdomains of my fqdn all the better. One cert to rule them all.
trying to expand on this simple example
# {
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# }
*.adomain.net {
tls adomain.net@gmail.com {
dns route53 {
max_retries 10
}
}
@docker host docker.645.adomain.net, docker.adomain.net, admin.adomain.net, admin.645.adomain.net
handle @docker {
reverse_proxy nadal.adomain.net:9016
}
@ha host ha.adomain.net, ha.645.adomain.net
handle @ha {
reverse_proxy hassos.645.adomain.net:8123
}
}
but either I am not getting the syntax correct or this is not possible.
see at the very bottom where I used a simple version like the example and it works. So wildcard cert itself is not the issue but rather this “muliple/more” subdomans.
2. Error messages and/or full log output:
There is no error in the logs
{"level":"info","ts":1706809672.0089629,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"*.adomain.net"}
nadal-caddy | {"level":"info","ts":1706809672.0094056,"logger":"tls.obtain","msg":"releasing lock","identifier":"*.adomain.net"}
but when I visit some the single subdomain urls (i.e. docker.adomain.net) I get a blank page, no errors in network inspector, the favicon is passed but that’s about it.
and the two deep subdomains I get
This site can’t provide a secure connectiondocker.645.subdomain.net sent an invalid response.
ERR_SSL_PROTOCOL_ERROR
3. Caddy version:
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
4. How I installed and ran Caddy:
I run caddy in a docker container with custom image I build.
The image grabs the latest release rather then load via alpine packages.
a. System environment:
latest alpine 3.19
b. Command:
/opt/caddy/bin/caddy run --config test.conf --adapter caddyfile
services:
caddy:
container_name: ${NAME:-caddy}
image: ${IMAGE:-caddy}
# if no $CONF is given then Caddyfile in ${PWD}/conf:/opt/caddy/conf will be used
command: caddy run ${CONF}
hostname: ${NAME:-caddy}
env_file:
- $CREDENTIALS
volumes:
- data:/opt/caddy/data
- settings:/opt/caddy/settings
- conf:/opt/caddy/conf
# - files:/opt/caddy/files
restart: unless-stopped
ports:
- 80:80
- 443:443
- 2019:2019
# binding data and settings are not required
# But if there volumes are deleted caddy will need to redo all the certs
volumes:
data:
# driver_opts:
# type: none
# device: ${PWD}/data
# o: bind
settings:
# driver_opts:
# type: none
# device: ${PWD}/config
# o: bind
# files:
# driver_opts:
# type: none
# device: /data/Hacking/webfiles
# o: bind
conf:
driver_opts:
type: none
device: ${PWD}/conf
o: bind
d. My complete Caddy config:
see above
just so I tried a simple version like the example and that works.
# {
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# }
*.adomain.net {
tls adomain.net@gmail.com {
dns route53 {
max_retries 10
}
}
@docker host docker.adomain.net
handle @docker {
reverse_proxy nadal.adomain.net:9016
}
@ha host ha.adomain.net
handle @ha {
reverse_proxy hassos.645.adomain.net:8123
}
}