Can Caddy work for this

I’m experimenting with a project where i have:

  1. A single “localhost” virtual host
  2. My backend (rails) looks at the host env and serves up correct content for any domain
  3. already have this setup and tested in NGINX and works great!

Now i’m interested in switching to Caddy, for the HTTPS capability.

The big questions are this:

  1. Can caddy provision LetsEncrypt certs automatically for any random incoming host?
  2. Is there a way that I can “whitelist” a list of hosts (from potentially a thousand)
  3. Would I have to edit my caddy file every time as we add a new host in the backend system?

What would such a Caddy file look like?

Hey Ericson, welcome!

Yes. See On-Demand TLS

Yeah, put those hostnames (or a wildcard subdomain) as the site address in your Caddyfile. It may be long, but that’s okay. Caddy can serve tens of thousands of sites (or more) per instance.

Depends. If they’re subdomains, not necessarily (wildcards). Second-level domains, probably (you can but don’t want to use *.com, for example).

* {
    proxy /   # or whatever your rails backend is

Thanks. sounds great.
We are going to test this and publish our caddy file when we have it right,