Closed write3371 closed 4 months ago
can I add mypolicy2 at the same URL but routing to a different apiserver2? Or can I set different envs when mypolicy1 or mypolicy2 is matched?
@write3371 , it is done with route handlers, which have matchers. then, you execute only the plugin you want.
handle x with condition a {
authorize with mypolicy1
reverse_proxy apiserver1:8080
}
handle x with condition b {
authorize with mypolicy2
reverse_proxy apiserver2:8080
}
It is caddy thing, not something specific to this plugin.
Thanks for answering! Can I use username or roles as the condition ?
@write3371 , i think you could do it, by authorizing first, passing roles/username via x headers, and then matching on the x headers.
The username is also being populated inside caddy context. In theory, you could match there too.
How to reverse proxy to different server based on multiple policy? say i have configured
can I add mypolicy2 at the same URL but routing to a different apiserver2? Or can I set different envs when mypolicy1 or mypolicy2 is matched?