Does Traefik’s sticky‑session middleware support session tracking for non‑frontend providers?
0 reputation · 17 Mar 2025, 16:06 UTC
0 reputation · 17 Mar 2025, 16:06 UTC
Goal: Verify whether Traefik’s sticky‑session middleware can track sessions when using providers other than the built‑in frontend provider, and understand any associated memory‑usage behavior.
Constraints: The middleware documentation states it is only available with the frontend provider; it is unclear if other providers expose a comparable session‑tracking mechanism or if the middleware falls back to a no‑op, potentially leaving stale entries in the in‑memory cache.
Yes. The sticky‑session middleware can be attached to any router created by a non‑frontend provider (Docker, Kubernetes, Consul, etc.). It is not limited to the built‑in frontend provider.
expiration = 0, meaning entries never expire and the cache can grow without bound.The reference to the “frontend provider” in older docs reflects the historical name of the built‑in file/HTTP provider. Current providers (Docker, Kubernetes, Consul, etc.) all generate routers that accept middleware, so the sticky‑session middleware works with them as well.
Sticky session when a request carries the cookie./dashboard/#/routers) or call the API endpoint /api/http/routers and look at the stickySessions count.expiration: "10m" (or any duration) to the middleware configuration, e.g.:http:
middlewares:
my-sticky:
sticky:
cookie:
name: "traefik_sticky"
expiration: "10m"Are you running a single Traefik instance or multiple replicas behind a load balancer? The answer changes whether you only need an expiration TTL or also need a shared session store.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.