Reputation: 3312
This is probably an unusual case as I'm trying to define a new Proxy Endpoint in an API Proxy.
Let's say I have a default
Proxy Endpoint with a Conditional Flow to match /myflow
and action == GET
and that works fine.
then I defined a new Proxy Endpoint (new_endpoint
) with its own Conditional Flow to match /mynewflow
and action == GET
.
/mynewflow
works fine and goes to the new_endpoint
as expected.
however
/myflow
is also now going to new_endpoint
! (i used the Trace tool and confirmed it).
Here is the HTTP Proxy Connection Settings for both:
<HTTPProxyConnection>
<BasePath>/v2</BasePath>
<Properties/>
<VirtualHost>default</VirtualHost>
<VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="default">
<TargetEndpoint>default</TargetEndpoint>
</RouteRule>
Is this expected? If it is, how do I make sure that /myflow
routes to default
Proxy Endpoint?
Upvotes: 1
Views: 2031
Reputation: 3312
I learned something today: apparently it's HttpProxyConnection/BasePath
dictates which Proxy Endpoint is selected
as soon as made sure that the BasePath
is different for both endpoints, routing started the way I expected it to.
Upvotes: 1
Reputation: 1208
Looks like you're missing your <RouteRule> in your proxy. Just like the ConditionalFlow, you need a second RouteRule to point to your new target, which would look something like this:
<HTTPProxyConnection>
<BasePath>/v2</BasePath>
<Properties/>
<VirtualHost>default</VirtualHost>
<VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="new_endpoint">
<TargetEndpoint>new_endpoint</TargetEndpoint>
<Condition>(proxy.pathsuffix MatchesPath "/mynewflow")</Condition>
</RouteRule>
<RouteRule name="default">
<TargetEndpoint>default</TargetEndpoint>
</RouteRule>
You don't need to include individual verbs, because we can assume everything to /mynewflow is going to go to the new_endpoint target.
Also, make sure you put the conditional RouteRule above the default RouteRule -- Apigee will match the first one so if default (no condition) is first, you will never match the condition on the remaining rules.
Upvotes: 2