Search code examples
apigee

How to force a Response in the Request flow skipping the Target Endpoint


In a Apigee EDGE API Proxy, while processing policies in the API proxy Request flow, how one can force the Flow to go to the Response Flow and skip sending the request to the Target Service, without using a Raise Fault policy or ResponseCache policy??


Solution

  • You can use a RouteRule with no TargetEndpoint value. Choose a condition that matches when you want to bypass the target service. RouteRules are evaluated in order from top to bottom, with the first Condition match being chosen.

    <RouteRule name="noTarget">
        <Condition>skipTarget = true</Condition>
        <!-- no target endpoint -->
    </RouteRule>
    <RouteRule name="default">
        <!-- no condition, so this one always matches -->
        <TargetEndpoint>default</TargetEndpoint>
    </RouteRule>
    

    See this link for more info.