Setting request headers with values from a JWT

Before Istio 1.5 with the mixer it was easy to set headers related to values included in a JWT.

How can I do this in Istio 1.5?

Example:

  • Bearer token in a request includes the user id as [sub]
  • UserId should be included as header “X-user-id”
1 Like

Do you want to inject request headers before JWT is forwarded to the application? One way you can do is to inject an EnvoyFilter after Istio authentication filter, and add your logic of settings headers there.

I found this yesterday looking for something else

1 Like

Hello,

This code works with istio 1.5.x.

Jwt auth and envoy filter