Logging info from JWT token


Is it possible to have Traefik decode a JWT access token and include the subject (and/or other claims) in the JSON logs? (The authorization itself is done in backend services.)


Hi @jcassee, no it is not a Traefik feature. The idea is to delegate the authorization process to another actor by using the middleware forwardAuth (ref. https://docs.traefik.io/v2.0/middlewares/forwardauth/), which would be responsible for this.

Alright, so the authorization process would just decode the JWT, add the subject claim as a header and I would configure authResponseHeaders to copy those header into the forwarded request, so Traefik will log them in the downstream header field?