I want to setup a catch-all redirect for domain B that redirects to domain A but keeps the subdomain and URI of the original request.
An example config could look like this:
While rewrite supports regex, redir does not. Nor is there an appropriate request placeholder. It may not be possible for Caddy to perform a redir that carries the subdomain forward as you’ve specified.
If you have a list of subdomains you expect to use, you can add a directive to your Caddyfile for each one.