You can use Traefik redirectregex middleware. I just created a separate service to redirect everything with prio=1, meaning the lowest one, if no other domain or path is matched. The service in it is not really used, you can copy the middleware to another container:
Note there is a caveat: because of the non-fixed hostname in my example, Traefik in general doesn't generate new LetsEncrypt certificates for this service. So you would need to use own or LE generated wildcard certificates (with DNS challenge) for this to work under TLS/SSL.
Or you just list all domains in the rule (they still need valid DNS entries for LE):
to my existing config, it redirects all domains but I'm getting an infinite redirect loop, because in this case https://example.com is also in my .rule="Host(https://example.com)
My guess is it would work if I could exclude one domain and not match against all domains with the regex.
You can use Traefik redirectregex middleware. I just created a separate service to redirect everything with prio=1, meaning the lowest one, if no other domain or path is matched. The service in it is not really used, you can copy the middleware to another container