In Azure APIM, Routing users to different backend hostnames via product level?

Anonymous
2022-07-19T05:32:40.29+00:00

Having different set of APIs,

few for staging:

   https://api.azurewebsites.net/client,  
   https://api.azurewebsites.net/session  

and few for production

   https://api.azurewebsites.net/client  
   https://api.azurewebsites.net/session  

Created 2 products productionapis and stagingapis. How to route clients to their env backend hostnames by setting backend policies?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,769 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sebastian 241 Reputation points
    2022-07-19T05:40:35.847+00:00

    Hi, you can use a policy statement like

    <when condition="@(context.Response.StatusCode == 200 && context.Product.Name.Equals("Starter"))">

    on this basis you could redirect the request to a different backend:

    https://learn.microsoft.com/en-us/azure/api-management/api-management-transformation-policies#SetBackendService

    Cheers,
    Sebastian

    0 comments No comments

0 additional answers

Sort by: Most helpful