I'm learning traefik so I'm probably missing something obvious here - but why doesn't below work like expected?
I want one basic auth setup for /dashboard
and another for /metrics
, plus limit the metrics endpoint by IP.
With this setup I can still reach the metrics endpoint from any internal IP, and no basic auth is required either.
---
http:
routers:
dashboard:
rule: Host(`traefik.internal`) && PathPrefix(`/dashboard`)
service: api@internal
middlewares:
- basicAuthDashboard
metrics:
rule: Host(`traefik.internal`) && PathPrefix(`/metrics`)
service: api@internal
middlewares:
- prometheusScraperAllowedIPs
- basicAuthMetrics
middlewares:
basicAuthDashboard:
basicAuth:
users:
- "admin:derp"
basicAuthMetrics:
basicAuth:
users:
- "metrics:derp"
prometheusScraperAllowedIPs:
ipWhiteList:
sourceRange:
- "192.0.8.0/24"