cloudblog
2020/02/06
February 06, 2020
3 min read

Geolocation Based API Request Routing

Image credits: Aksonsat Uanthoeng from Pexels

WSO2 API Cloud supports API gateways in multiple regions such as US East, US West, Brazil (São Paulo), EU (Ireland), EU (Frankfurt), Singapore, and Sydney. With the increasing number of API consumer bases, the demand to expose APIs on multiple gateway locations is a common customer requirement. WSO2 API Cloud addressed this requirement by allowing the configuration of multiple gateway URLs. As a next step, we are excited to announce geolocation-based API routing for customers using multiple gateways in WSO2 API Cloud.

In geolocation-based API request routing, the geolocation from which the requests originate is mapped to an API gateway residing in one of the configured regions, preferably to the region closest to where the API request originated from. Let's take a look at a set of use cases where it is important to apply geolocation-based API request routing.

  • To maintain optimum performance in serving API requests. This is a common use case where serving users from data centers that are geographically close to their location can significantly reduce the network overhead.
  • To distribute the load among the global user base when backend services are unable to serve from a single region/deployment due to scaling limitations of the computing resources.
  • When an API provider decides to expose localized and customized data specific to regions. These decisions are driven based on the business requirements, data access restrictions enforced to comply with local laws and regulations, etc.

Key points:

  • Single endpoint for all API consumers irrespective of the region from where the data is served. This is facilitated using Geo DNS. No changes to the existing API consumers since all consumers subscribe to the same API in developer portal and get a common gateway endpoint URL to invoke the APIs.
  • Backend services are replicated in multiple regions including data layers.

Now let’s see how to enable geolocation-based routing:

  • Identify the following:
    • The regions where consumer bases are distributed.
    • The regions where the backend services are hosted. As an example, let's assume the following setup:
      • Your API consumers are geographically distributed in US East, Oregon, and Ireland
      • You have the backends deployed in Oregon and Ireland regions
      • Ireland load balancer handles the traffic coming from the Ireland region
      • Oregon load balancer handles the traffic coming from all other regions except Ireland
    • Contact the WSO2 Cloud support team to enable the Geolocation based API request routing feature.