Guys, is it possible to do a global redirect in cases where there is no domain, for example, if I have nothing on
mydomain.com
->
google.com
, or
non-existent.mydomain.com
->
google.com
- now Traefik will just open a 404 page, if subdomain is non-existent it will be with certificate warning -> 404, if
mydoman.com
it's just 404... and etc. is it possible to add such a redirect?
I remember that such a redirect is possible, for example, in the nginx proxy manager.
Thanks.
- traefik.enable=true
- traefik.http.routers.catchall.rule=HostRegexp(`{host:.+}`)
- traefik.http.routers.catchall.priority=1
- traefik.http.routers.catchall.middlewares=redirectall
- traefik.http.middlewares.redirectall.redirectregex.regex=.*
- traefik.http.middlewares.redirectall.redirectregex.replacement=https://example.com
- traefik.http.services.catchall.loadbalancer.server.port=80
If no other router matches the request, this router is used as a fallback with the lowest priority.
This works for all
http
requests. It only works for
https
, when you have explicit certs for domains and/or sub-domains or use sub-domains with a wildcard cert.