In v1, one could setup Traefik to expose it's dashboard, api and ping, but the ping endpoint would not be subject to authentication.
In v2, I am unable to attach two services to the same router (api@internal, ping@internal) - and the middleware defined for authentication applies to the entire router; so even if I would get both services working on the same router, both would also be subject to authentication.
In v1 this was as simple as setting:
--entrypoints=Name: <http and https> ...
--entrypoints=Name:traefik Address::8080 Auth.Basic.Users:...
https://traefik.my.domain/dashboard -> required auth
https://traefik.my.domain/ping -> did not require auth
How can I achieve the same in Traefik v2?
My solution in v2 at the moment:
# Dashboard Authentication
# Secure Ping endpoint
- "traefik.http.routers.ping.rule=Host(`traefik.my.domain`) && Path(`/ping`)"
Is this the preferred/correct approach?
Hello, it's the correct approach.
Just a question: why do you want to expose your ping over internet?
To be able to perform ping probes from several different regions (For instance PingDom). This way I can determine amongst others availability of my web application from Asia and the USA.