Azure APIM route the incoming request based on request URL

0 votes

I have a use case to route the request based on incoming url

where in API URL suffix - apples/grapes

Case 1: suppose an incoming request is

https://fruits.com/apples/grapes/rest

then I need to divert the request to backend url say: https://stores.com/a/g

I am able to achieve this by adding <rewrite-uri template="/"/? to inbound policy

Case 2:

suppose if the incoming request is

https://fruits.com/apples/grapes/rest/a/b

then I need to route the request to the backend url: https://stores.com/a/g/caps/locks

I am able to achieve this by adding <rewrite-uri template="@(context.Request.Url.Path.Replace("rest/", ""))" /> to inbound policy


How do I achieve both the use-cases in the same operation? as the response would be different for both cases;

I am unable to filter the incoming request based on context.api.path; when I send the request for the first usecase I am getting 500: internal server error as apim is expecting url path after rest/

Mar 16, 2022 in Azure by Edureka
• 13,620 points
2,467 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Azure

0 votes
1 answer
0 votes
0 answers

How to disable cors on azure APIM?

I have enabled the cors policy in ...READ MORE

Mar 26, 2022 in Azure by Edureka
• 13,620 points
548 views
0 votes
1 answer

Properly encode URL for Webtest configuration XML with Terraform on Azure

Additionally, &domain hint= The domain userdomain.com is ...READ MORE

answered Apr 4, 2022 in Azure by Edureka
• 12,690 points
982 views
0 votes
1 answer
0 votes
1 answer

How to retrieve View definition on Synapse (Azure SQL DW)?

To authenticate with Azure SQL Database or ...READ MORE

answered Mar 4, 2022 in Azure by Edureka
• 13,620 points
1,287 views
0 votes
1 answer

Is it possible to combine two private DNS zones into one policy definition

You can configure your DNS settings for ...READ MORE

answered Mar 25, 2022 in Azure by Edureka
• 12,690 points
1,032 views
0 votes
1 answer
0 votes
1 answer

Call Azure API with nextLink (next page) in Power BI

Here is something you could try or ...READ MORE

answered Nov 12, 2018 in Power BI by Upasana
• 8,620 points
1,461 views
0 votes
1 answer

Calling Azure API using Power BI with Next Link

Try this let iterations = ...READ MORE

answered Apr 9, 2019 in Power BI by Shubham
• 13,490 points
1,641 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP