question

CharlesAntoineSaintLaurent-8331 avatar image
0 Votes"
CharlesAntoineSaintLaurent-8331 asked ·

API Gateway, or APIM for routing to multiple backends?

Hello,

Here is my scenario: I'd like to implement APIM, but I have multiple backends (https://001.host.ca/Api, https://002.host.ca/Api, etc.) for each client. Ideally, I'd want only 1 APIM instance (example: https://apim.azure-api.net/XXX/api/) where XXX would be changed by the client so it would route him to the correct backend. The goal of having only 1 APIM instance is to be able to set the same policies for all clients.

My questions
1- Where should this routing logic be configured (APIM inbouding processing? API Gateway?)
2-Is this the correct way to set this up? Is this most convenient way?

Thank you

azure-api-managementazure-application-gateway
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PramodValavala-MSFT avatar image
1 Vote"
PramodValavala-MSFT answered ·

@CharlesAntoineSaintLaurent-8331 You can use the set-backend-service policy to forward the request to the appropriate backend based on the incoming request.

You would have to add a parameterized operation and fetch the parameter from the MatchedParametersproperty of the context.Request object.

To answer your exact questions
1. Since you need APIM policies, requests will have to go through APIM. With the above policies, you can cut out one extra hop required.
2. This is convenient for sure with less moving parts and based on your requirement (to what you've shared) this seems like a reasonable way to set it up


· 1
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for that answer! I've ended up adding the baseUrl in the token, and extract it on every request in order to redirect to the good backend.

0 Votes 0 ·