Is it possible to proxy other ProxyTarget, if Rate-limiting is exceeded?

I would like to proxy other proxyTarget if primary proxyTarget's Rate-limiting is exceeded. Because that primary proxyTarget is synched api(will be executed ontime) and sub proxyTarget is asynhed api(requiest is will be queued) for backend system resource resason.

regards,

0 5 167
5 REPLIES 5

Technically yes, one way is to use the fault rules and catch the ratelimit exceeded error and then use a Service callout to call other proxy or rest API.

But if your 2nd sub Target is asynch in nature then the actual apogee proxy might give timedout error.

Try to explain your scenario in detail for alternate solutions.

I am sorry that my English is so bad... "async"

I said is just backend behavior.

in API consumer(client) perspective, api request is returned soon.

what i want to achieve is that to proxy other ProxyTarget, if Rate-limiting is exceeded

Siddharth's answer is correct, but. . . .

possibly there is another option.

It may be that TargetServers will satisfy your requirement.

In particular you can create a "fallback" server. This may fit your requirement. Check the documentation to explore the idea.

thank you for your answers!

I have tried to implement @Dino-at-Google idea first.

But, that is not working...

All request is routed to default (http://3.115.158.42:3001)

Where is incorrect setting?

regareds,

# ProxyEndpoint

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="quota">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <Name>Quota</Name>
            </Step>
        </Request>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPProxyConnection>
        <BasePath>/quota</BasePath>
        <Properties/>
        <VirtualHost>default</VirtualHost>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="quota">
        <TargetEndpoint>quota</TargetEndpoint>
    </RouteRule>
</ProxyEndpoint>


# TargetEndpoint
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="quota">
    <Description/>
    <HTTPTargetConnection>
        <LoadBalancer>
            <Algorithm>RoundRobin</Algorithm>
            <Server name="quota"/>
            <Server name="default">
                <IsFallback>true</IsFallback>
            </Server>
        </LoadBalancer>
        <Path>/</Path>
    </HTTPTargetConnection>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request/>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection name="quota">
        <Properties/>
        <URL>http://3.115.158.42:3000</URL>
    </HTTPTargetConnection>
    <HTTPTargetConnection name="default">
        <Properties/>
        <URL>http://3.115.158.42:3001</URL>
    </HTTPTargetConnection>
</TargetEndpoint>