# service on a single subdomain
service.mydominio.com {
reverse_proxy my_service:80
}
# default page for mydominio.com
hello.mydominio.com {
root * /var/www/defaults/mydominio
file_server {
hide .git
}
}
# redirect all the other non specified subdomains
*.mydominio.com {
redir https://hello.mydominio.com
}
3. The problem Iâm having:
I have multiple domains (like mydominio.com, mydominio2.com etc) on my server. I want to redirect all the subdomains of a single domain not already used by a specific service (letâs say I misstype asdfg.mydominio.com) to a simple page (hello.mydominio.com). Iâm using â*.mydominio.comâ to do this but it tries to obtain a wildcard certificate (no plugin is available for my dns provider). How do I disable the certificate retrieval or obtain this kind of redirect?
4. Error messages and/or full log output:
{âlevelâ:âerrorâ,âtsâ:1638459072.5763295,âloggerâ:âtls.obtainâ,âmsgâ:âwill retryâ,âerrorâ:"[.mydominio.com] Obtain: [.mydominio.com] solving challenges: *.mydominio.com: no solvers available for remaining challenges
5. What I already tried:
Using âhttp://*.mydominio.com {}â to at least redirect http domains.
Checked the automatic_https directive but it does not seem to be useful for wildcard domains.
TLS off is no available.
Caddy needs a certificate to complete the TLS handshake for HTTPS requests. Caddy canât respond unless the handshake succeeds (browsers wouldnât accept/trust the response unless it succeeded)
If you only care to redirect HTTP requests, then you can prefix the site address with http:// to prevent it from trying to provision a certificate for that name. But if you also want HTTPS requests, you still need a certificate.
An alternative option is that you could use the duckdns plugin (and get a DuckDNS domain for free) and set up DNS challenge delegation. That way Caddy doesnât need API access to netcup, and ACME issuers will follow the CNAME to get the challenge from the DuckDNS domain instead.
I have several domains managed with my Caddyfile. I want to redirect all the wrong subdomains request (requests to non-existing domains) to their own page (grouped by domain). I donât have wildcard certificate support because my provider is not supported (netcup)
My solution was to catch all the âremainingâ http and https traffic and use the host and handle directives to manage them
FYI using https:// wonât actually âcatch remaining HTTPS trafficâ because Caddy wonât have a certificate that will allow for the TLS handshake to complete.