http: routers: # Public API router: matches /api* but explicitly excludes the # /api/admin and /api/internal subtrees so the public strip-prefix # route can never collide with the protected router's paths. public-api: rule: 'PathPrefix(`/api`) && !PathPrefix(`/api/admin`) && !PathPrefix(`/api/internal`)' entryPoints: - web middlewares: - strip-api service: backend # Protected router: everything under /admin and /internal requires # HTTP Basic authentication. protected: rule: 'PathPrefix(`/admin`) || PathPrefix(`/internal`)' entryPoints: - web middlewares: - auth service: backend middlewares: strip-api: stripPrefix: prefixes: - /api auth: basicAuth: users: - 'admin:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/' services: backend: loadBalancer: servers: - url: http://backend:9000