An Azure service that provides a hybrid, multi-cloud management platform for APIs.
@Rahul Prabhu Thank you for your reply. Yes, you can create a new API with default API URL suffix (empty) or api/v1 simply for the purpose of redirection. In that API, you can define an operation with URL as "/" and set inbound policy with return-response like below:
<inbound>
<choose>
<when condition="@(context.Request.OriginalUrl.Host == "dev1.apim.custom.com")">
<return-response>
<set-status code="303" />
<set-header name="Location" exists-action="override">
<value>@("https://" + context.Request.OriginalUrl.Host + "/dev1/api/v1")</value>
</set-header>
</return-response>
</when>
<when condition="@(context.Request.OriginalUrl.Host == "dev2.apim.custom.com")">
<return-response>
<set-status code="303" />
<set-header name="Location" exists-action="override">
<value>@("https://" + context.Request.OriginalUrl.Host + "/dev2/api/v1")</value>
</set-header>
</return-response>
</when>
</choose>
<base />
</inbound>
Please make sure to set redirect policy logic above base element.
This way whenever you hit dev1.apim.custom.com/api/v1, based on the condition it should redirect to dev1/api/v1 and similarly for dev2.apim.custom.com/api/v1, it goes to dev2/api/v1. Please validate and let me know if you ran into any issues.
Just a note, make sure that API(s) is grouped accordingly if you enable a subscription key for the product. Also, if needed, restrict other domains from accessing API directly (dev1.apim.custom.com/dev2/api/v1 or dev2.apim.custom.com/dev1/api/v1) as mentioned here.
I hope this answers your question and feel free to add if you have any questions. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.