Description
openedon Nov 7, 2023
The issue is that the certificate loaded via the tls directive from files in the second site block for website2, containing a catch-all, is used for all request to caddy. Only the certificate is used.
The content is still used from the requested domain/site/block. Meaning, each request returns the wanted content from the requested application, just the certificate is from completely different site block.
For example, https://subdomain.website1.com
returns certificate 2, when certificate 1 is expected.
Expected behaviour would be:
https://subdomain.website1.com
-> certificate 1https://www.website1.com
-> certificate 2https://www.website2.com
-> certificate 2https://www.example.com
-> certificate 2https://test.website2.com
-> certificate 2
However, certificate 2 is returned every time.
Caddy is only hit with https
requests. http
requests or http
to https
redirects don't play a role.
The following docs lead me to believe, I configured this correctly and like it was intended:
- https://caddyserver.com/docs/caddyfile/concepts#addresses
- https://caddyserver.com/docs/caddyfile/concepts#blocks
Things that were tried:
- replacing
:443
withhttps://
- switching the import order in the main Caddyfile
Main Caddyfile:
import /home/deployer/website1/Caddyfile
import /home/deployer/website2/Caddyfile
website1 Caddyfile (uses automatic https, no tls directive is configured):
subdomain.website1.com {
...
}
website2 Caddyfile:
www.website2.com,
*.website2.com,
:443 {
tls cert.pem key.pem
...
}
Caddy version: v2.7.5
Modules: