Configure a proxy NOT routing it to any target servers, How can I design it?

0 0 2,509

How often do we run into a use case where we don't want the requests routed to any particular target backends? Many times all we need is - a bunch of mediation,mock up responses and respond back to the client.

If we know the concept of route rules in Apigee, we can just tweak it a bit and have it work for our purpose.

Route rules have a configurable TargetEndpoint which can be conditionally executed. So based on a certain set of conditions I can route my requests to a particular backend.

Example of a regular route rule-

<RouteRule name="foo">
  <Condition>(proxy.pathsuffix MatchesPath "/{version}/foo")</Condition>           <TargetEndpoint>foo-target</TargetEndpoint> 
</RouteRule> 

Now if I just have a route rule configured without having a TargetEndpoint, just based on the conditions, it will NOT route the request to any target backends.

<RouteRule name="no-target">
 <Condition>(proxy.pathsuffix MatchesPath "/{version}/log"</Condition>
</RouteRule>

We can just perform some request validations, do some mediation and mashup a response and send it back to the client - all within Apigee. This is a very common use case where if a backend is not yet ready, we could still mock up responses and have an api consumable for the clients.

Version history
Last update:
‎04-13-2015 02:49 PM
Updated by: