Variable set in javascript is not displayed in quota identifier

Not applicable

6638-untitled.png

Hello, I'm trying to setup an Apigee proxy with a quota policy. I want the <Identifier> of the quota policy to include both a clientId, which is passed through a JWT, and the client's IP, for more granularity.

To do this, I use Decode JWT policy + a custom Javascript that does the following:

context.setVariable("client.identifier", context.getVariable("jwt.decode-jwt.claim.clientId") + context.getVariable("client.ip"));

Then later, in the quota configuration, I specify

<Identifier ref="client.identifier"/>

However, when quota limitation kicks in, the fault message has "_default" as identifier ("Rate limit quota violation. Quota limit exceeded. Identifier : _default"). I tried to trace the request, and I can see that the client.identifier is being set properly (see attached screenshot).

Could someone please explain what am I doing wrong?

2 1 235
1 REPLY 1

That's odd , you are right . Nice catch.

It seems like client.identifier value is coming as _default. So for anything with client.<anything> apart from pre-defined variables.

It looks like client is a reserved object for apigee and any unavailable variable reference is resorting to value _default.

Use client_identifier or anything else instead it will work.