November 30, 2015

Sample for Restricting Proxy with Throttle Mediator

Following is a sample of using Throttle mediator to restrict local proxy invocations. Notice that the IP has to be given as and not "localhost".

A custom fault message can be added within onreject/makefault/reason tag (line 19-23) . Custom fault messages cannot be added for service level throttling.

<proxy name="ThrottleMediatorSample" startonload="true" trace="disable" transports="https http" xmlns="">
         <throttle id="A">
               <wsp:policy wsu:id="WSO2MediatorThrottlingPolicy" xmlns:throttle="" xmlns:wsp="" xmlns:wsu="">
                        <throttle:id throttle:type="IP"></throttle:id>
               <makefault response="true" version="soap11">
                  <code value="tns:Receiver" xmlns:tns="">
                     <reason value="ERROR : Restricted IP Address"/>
                     <address uri="http://localhost:9000/services/SimpleStockQuoteService">

Reference :