How to route to target server when we have dedicated server for each tenant

We have different server for each tenant. We have to route to right tenant server when api is getting called.

One approach I took is - Created a custom attribute targetHost in app which is used in api-proxy in redirecting the api call to right target server.  But this approach doesn't look good,  Is there any other standard approach through which we can achieve this ?

 

 

0 5 153
5 REPLIES 5

You need a differentiator either in the custom attributes of the app or the incoming api request carrying the information identifying the tenant.

You could have a KVM of the TargetServer names identified by a key. The key(tenant-name) can be in the client request, so at proxy execution you extract the key and fetch the KVM value and route to the identified Target. OR use your approach to place this key as part of the app custom attributes, extract the KVM value and route to it.

Hope this helps. 

The constraint here is, any app should only be access to their authorized Tenant target server.

Q1- How can we ensure this Authorization? One of the way is creating a developer account for each tenant by placing a tenant attribute to developer custom attribute, while fetching Is this a standard approach using? 

Q2- Also let's say we fetch target server using KVM. Still we can't apply <Server name="server_name">  as it's doesn't accept the dynamic variable. 

One option is to set target.url based on the KVM extract
https://www.googlecloudcommunity.com/gc/Apigee/How-to-dynamically-set-target-URL/m-p/11689

How many tenants does your proxy support?? How are you planning to onboard a consumer (when they create an app) with the target url associated to them? Will you be updating the KVMs with the consumer identifier and the associated target url ??

How many tenants does your proxy support?

- Couple of hundred 

How are you planning to onboard a consumer (when they create an app) with the target url associated to them?  Will you be updating the KVMs with the consumer identifier and the associated target url ??

- Thinking of using developer custom attribute, but seeking the standard approach for the same. 

@anuragjain67 - how about associating the tenant info to the app as custom attribute? You could set the URL or the tenant ID to the app and then when Apigee executes VerifyAccessToken or API Key or even VerifyJWT, we should be able to pick that and then use that as the target URL or build the target URL to route the request.

NOTE: When a developer creates an app in the dev portal, this custom attribute will not be added. You will need to add that after the app is created. So have a catchall URL until its added.