Geo based routing

Not applicable

My use case is , We have service which is hosted on east pcf server and the same one hosted in west pcf server. We have created one Apigee proxy with two target endpoints. one for east and another one for west. Because we host our application in two different PCF servers ( East and West). East PCF service pointing different database server and west pcf server pointing to different database server. But I don't know how to route my request based on location ? i.e if any request comes to apigee proxy from east or close to east then that request should go to east target endpoint or if that request comes to apigee proxy from west or close to west location then it has to redirect to west target endpoint. How do we handle this?

I am expecting a solution such a way that we need to route to respective end points based on the location. I hope you get my use case.

I refer below one. but I dont know how to set route rule and condition?

<RouteRule name='East'>

<TargetEndpoint>eastBackendTarget</TargetEndpoint>

<Condition>system.region.name ~~ "us-east-.+"</Condition>

</RouteRule> <RouteRule name='West'>

<TargetEndpoint>westBackendTarget</TargetEndpoint>

<Condition>system.region.name ~~ "us-west-.+"</Condition>

</RouteRule> <RouteRule name='Default'>

<TargetEndpoint>defaultBackendTarget</TargetEndpoint>

</RouteRule>

Regards,

Paranthagan R

0 2 377
2 REPLIES 2

Do you get any details regarding the location in the incoming/request call?

If we get location details either in headers/queryparams etc, then we can use that info as Condition in Route Rules.

Since it is either east or west, only 2 route rules would be enough.

<RouteRule name="east">
         <Condition>request.header.location = east</Condition>
        <TargetEndpoint>east-target</TargetEndpoint>
    </RouteRule>
    <RouteRule name="default">
        <TargetEndpoint>default</TargetEndpoint>
    </RouteRule>

Thanks Siddharth for the response. Unfortunately my request header will not have that details and its not possible to add location details with header . Any other way to achieve this use case?