How to validate token header by path RequestAuthentication

I have an AuthenticationPolicy implemented like this:

kind: RequestAuthentication
  name: "jwt-example"
  namespace: istio-system
      istio: ingressgateway
  - issuer: ""
    jwksUri: ""

By using AuthorizationPolicy I have some paths that require a valid token and some that don’t. The problem is that in some paths that don’t require a valid token the client is sending a request with a Authorization header with non-JWT token (the end application will handle this token), but in this case the RequestAuthentication is returning an 401 on because this non-JWT token is an invalid JWT.

I would like to know if there is a way how to bypass this token validation, at least in some paths.

That’s an interesting use case, the problem is the RequestAuthentication cannot distinguish the two tokens so it has to reject the “invalid” one otherwise it could be a security bypass.

For the non-JWT token, is it possible to put it in a different header or use a different prefix than the “Bearer”?