How to extract path from the uri

i have used extract variable policy ,to extract the path suffix and route rule to direct to a specified target basing on the path.

<URIPath name="path"> <Pattern ignoreCase="false">{request.proxy.pathsuffix}</Pattern> </URIPath>

<RouteRule name="Target1"> <Condition>{request.proxy.pathsuffix == "/Facebook/**"}</Condition> <TargetEndpoint>Target1</TargetEndpoint> </RouteRule>

What am i doing wrong ,because it is alwasy calling th default target instead of specified one. @Anilsagar

0 3 1,104
3 REPLIES 3

instead of request.proxy.pathsuffix, try proxy.pathsuffix in your Condition in the RouteRule.

You don't need to explicitly extract this, as proxy.pathsuffix is already populated in a variable.

See the full list here: docs.apigee.com/api-services/reference/variables-reference

Thanks, Sean

<Condition>{proxy.pathsuffix == "/Facebook"}</Condition> I tried this did not work

Make sure the Conditional RouteRule is specified first, before the Default route rule, as they are evaluated top-to-bottom. Also, instead of using the == operator in the Condition, use the MatchesPath operator.