Traefik "middleware ... does not exist" in CI
A Traefik router lists a middleware that is not defined, or names it without the provider suffix (@file, @kubernetescrd). Traefik cannot resolve the reference, so the router is dropped.
What this error means
Traefik logs "middleware X does not exist" and the router that referenced it is removed from the active configuration.
level=error msg="middleware auth@file does not exist" routerName=my-router@file
Common causes
The middleware is not defined
The router references a middleware name that has no matching entry under http.middlewares.
Missing provider namespace on the reference
Cross-provider references need a suffix like @file or @kubernetescrd; without it Traefik looks in the wrong namespace.
How to fix it
Define the middleware and reference it correctly
- Add the middleware under
http.middlewares. - Reference it on the router, including the provider suffix when crossing providers.
- Reload and confirm the router keeps the middleware.
http:
middlewares:
auth:
basicAuth:
users:
- "user:$apr1$..."
routers:
my-router:
middlewares:
- auth@fileMatch Kubernetes CRD middleware namespaces
For the Kubernetes provider, reference the Middleware by <namespace>-<name>@kubernetescrd so it resolves.
traefik.ingress.kubernetes.io/router.middlewares: default-auth@kubernetescrdHow to prevent it
- Define every middleware before referencing it on a router.
- Include the provider suffix on cross-provider middleware references.
- Validate the merged dynamic config in CI.