I'm trying to define a route rule where request is sent to a certain target only for certain client_ids. I don't want to hard-code these client ids in the proxy but instead get them from KVM. I will keep them in KVM as a comma-separated list.
In my Route Rule defintion, I want to check if apigee.client_id is present as one of the values retrieved from this KVM and route to this target.
How can I do that?
Essentially I'm expecting an IN condition which does not exist.
<Condition>(apigee.client_id IN KVM.client_ids)</Condition>
I will use this proxy for a canary deployment so I can control and add clients to this target.
Solved! Go to Solution.
yes I get it.
Unfortunately there is no condition expression in Apigee that allows you to evaluate that.
The way I would do it:
run some Javascript that performs the check.
var clientId = context.getVariable('apigee.client_id'); var canaryList = context.getVariable('KVM.client_ids'); context.setVariable('canary-client', canaryList.indexOf(clientId)>=0);
And then use that variable in your condition:
<Condition>canary-client is true</Condition>
yes I get it.
Unfortunately there is no condition expression in Apigee that allows you to evaluate that.
The way I would do it:
run some Javascript that performs the check.
var clientId = context.getVariable('apigee.client_id'); var canaryList = context.getVariable('KVM.client_ids'); context.setVariable('canary-client', canaryList.indexOf(clientId)>=0);
And then use that variable in your condition:
<Condition>canary-client is true</Condition>
this solution works just as fine. thanks a lot.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |