Hi,
I have many proxies configured on Apigee. I want to throttle the request message size from clients to particular size(for instance 2mb) for a single proxy(other proxies should follow default rules). How do I go about it?
Got it working.
Post an answer on how you got it working.
It will be useful to others.
We need to add the below script in preflow which will give us the message size in bytes.
var requestContent = context.getVariable('request.content');
var contentLength = requestContent.length;
context.setVariable("request.header.Content-Length", contentLength);
Then put a conditional flow to raise a fault if the request message is bigger than the allowed limit, something like below.
<PreFlow name="PreFlow">
<Request>
<Step>
<Name>JavaScript-3</Name>
</Step>
<Step>
<Name>Raise-Fault-2</Name>
<Condition>(request.header.Content-Length > "2000")</Condition>
</Step>
</Request> <Response/>
</PreFlow>
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |