1. Caddy version (caddy version
):
v2.3
2. How I run Caddy:
caddy run --config=caddy.json
a. System environment:
Ubuntu 20.04
b. Command:
caddy run --config=caddy.json
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
{
"apps": {
"tls":{
"automation":{
"policies":[{
"issuer":{
"module": "acme",
"challenges": {
"dns": {
"provider": {
"name": "cloudflare",
"api_token": "CLOUDFLARE_API_TOKEN"
}
}
}
}
}]
}
},
"http": {
"servers": {
"example": {
"listen": [":443"],
"routes": [
{
"match": [{"host": [
"app.example.net"
]}],
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{"dial":"x.x.x.x:4000"}]
}]
},
{
"match": [{"host": [
"*.example.net",
"example1.co.li",
"example2.co.li",
"example3.com"
]}],
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{"dial":"x.x.x.x:5000"}
]
}]
}
]
}
}
}
}
}
3. The problem I’m having:
I want to server my clients domains from caddy, some of them are using subdomains and some of them are using white label domains.
Subdomains are working fine by adding wildcard record i.e. *.example.net .
But the problem is, right now I am adding each white label domain in my config file to make it work. Like this -
"match": [{"host": [
"*.example.net",
"example1.co.li",
"example2.co.li",
"example3.com"
]}],
As per your documentation, it is possible to configure caddy to serve all the domain names you do not know and that can’t be configured ahead of time.
But I was enable to find how to do that.
4. Error messages and/or full log output:
When I try to access the new white label domain example4.co.li then I got “Secure Connection Failed” error.
5. What I already tried:
I tried to add “*” along with all the listed domains to support all the upcoming clients white label domains but it didn’t work.