ForwardAuth Middleware is not working in Traefik as API Gateway ForwardAuth Middleware is not working in Traefik as API Gateway docker docker

ForwardAuth Middleware is not working in Traefik as API Gateway


I was struggling with this for a while as well, and couldn't find an answer anywhere other than fairly hidden in the Traefik docs. The ForwardAuth docs don't actually mention this, but looking at the middlewares overview configuration example I suddenly noticed that you not only have to specify the middleware, you also have to apply it to the router.

Adding this label to whoami service should do the trick:

- "traefik.http.routers.whoami.middlewares=testauth"

Note that you can also specify multiple middlewares here, by comma-separating them, so you could add the other middlewares you defined like so:

- "traefik.http.routers.whoami.middlewares=testauth,test-redirectscheme,test-replacepath"