Hi all,
How can I set "default routes" like redirect to www.somewhere.com which will be used in case no other routers have been selected?
Thank you,
AP
Hi all,
How can I set "default routes" like redirect to www.somewhere.com which will be used in case no other routers have been selected?
Thank you,
AP
Use a route such as Path(`/`)
or PathPrefix(`/`)
combined with redirect regex middleware also set it to a very low priority (1) so it is evaluated after all other routes.
This has limited use with https unless you have a wildcard certificate as a TLS would occur before a request could be sent.
Why can't Traefik create certificates for any requests to the default route?
TLS certs are issued for a domain or for a wildcard on one level of the domain (*.example.com
).
LetsEncrypt can use Host()
to figure out the domain, even Host() || Host()
for multiple domains. For a wildcard cert you need domain/main/sans
, that only works with dnsChallenge.
In my case wildcards are irrelevant, this is for multiple domains, I just don't know what they are because they haven't been bought yet. I know how to do this with nginx/bash and certbot, so it is definitely possible - just a question of whether or not Traefik can be configured to do it.