Configure Custom Policies
Policies like throttling or other custom policies can be configured by adding XML files to the policies folder.
Quota Policy
Points to note:
- <’enabled’> denotes status. The enabled status can be set to ‘true/false’.
- <’TimeUnit’> denotes unit type. The unit type can be set to minute, hour, day, week & month.
- <’Interval’> denotes period. The interval can be given in numbers.
- <’Allow’> count denotes a number of hits allowed per allowed period under provided unit.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Quota async="false" continueOnError="false" enabled="true" name="Quota-ApiQuota" type="flexi"> <DisplayName>Quota-ApiQuota</DisplayName> <Identifier ref="tokenValidation.clientId"/> <Allow count="1000"/> <Interval>1</Interval> <TimeUnit>minute</TimeUnit> <Distributed>true</Distributed> <Synchronous>true</Synchronous></Quota>Spike Arrest Policy
Points to note:
- <’enabled’ denotes status. It can be set to ‘true/false’>
- <Rate denotes total hits per second / minute (ps for second & pm for minute) >
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SpikeArrest async="false" continueOnError="false" enabled="true" name="SpikeArrest-ApiSpike"> <DisplayName>SpikeArrest-ApiSpike</DisplayName> <Rate>10000ps</Rate> <UseEffectiveCount>true</UseEffectiveCount></SpikeArrest>Throttling related files must be included to Preflow element while defining the API Proxy seetings. For more details refer to Editing Templates.