I already have various domains in my Caddyfile, but other domains are just meant to display a default page (just telling that the domain is not used yet, basically), I could declare each one manually but there may be a way to declare a default web site, either served by Caddy or defined as a reverse proxy definition ? I couldn’t find in the Caddy documentation anything like that.
I’m not sure I understand your request. Do you want a catch-all definition for all domain names that you don’t care about? Or do you want to just group the ones that respond with the default page under one config block?
For the former, it’s impossible to reply on HTTPS without having a certificate for that domain name, and it isn’t recommended because you’ll fill up your filesystem with certificate unrelated to you.
If it’s the latter, you can, for example, configure one block for multiple domain names and another for the rest. Like
Another way can be by (ab)using the map directive, but that may be too convoluted so I’ll leave it until you actually clarify if your need is already satisfied or still need other approaches
I wouldn’t recommend it at all because you’re inviting denial of service against yourself. Caddy can issue certificates for domain names on the fly (on-demand), but it should be coupled with an “ask” endpoint to issue certs for approved domain names. Leaving it open for all domains imaginable leaves you susceptible to abusers who can request random domain names in a tight-loop until your disk space is filled.
Any layer you devise will work more-or-less similar to the ask function. I’m confused why do you want to accept any requests directed for any domain name, even the ones you don’t own, manage, or expect to handle. Why would you want to answer every domain name in existence just because a random attacker pointed it at your server? Is it a legitimate business reason?