Dynamic routing based on JWT Claim
What is the problem your feature solves, or the need it fulfills?
Dynamic routing based on JWT Claim.
Is a technique where the routing decision for incoming requests is made dynamically by examining the claims present in the JWT provided in the request.
This method allows for highly flexible and secure API management, as routing decisions can be customized based on the user's identity, roles, or any other attributes included in the token.
Describe the solution you'd like
I would like to enable it by a plugin or a configuration method
Describe alternatives you've considered
None, I've only came across with "Pingora" recently and I know some other solutions that have this feature.
You should certainly be able to do this though the functionality is not likely to live within the core pingora code itself (more likely a module or your own code).
You can do this in the request_filter where you have access to the request, it doesn't look like a difficult task. In addition, you can make it much more flexible and with your own rules.
as an example of an idea, we have a similar yml config in our project, in which we describe the rules and apply them.
services:
- path: "/endpoint"
target_host: "localhost:8080"
policies: ["test_policy"]
tls: true
sni: "localhost"
endpoints:
private:
- path: "^/metrics"
public:
- path: "^/"
# policies: ["test_policy2"]
- path: "^/get"