A company hosts a legacy REST service behind an Azure API Management (APIM) instance. To prepare the service for migration, you must configure APIM policies to meet the following requirements:
- Remove the '/api/v1' path prefix from all incoming request URLs before forwarding them to the backend service.
- Limit clients to a maximum rate of 500 requests per 60 seconds per subscription.
Which two of the following policy fragments should you add to the <inbound> section of the policy XML file to satisfy these requirements? (Choose two.)
- <rewrite-uri template="@(context.Request.Url.Path.Replace("/api/v1", ""))" />Answer
- <rate-limit calls="500" renewal-period="60" />Answer
- C<rate-limit-by-key calls="500" renewal-period="60" counter-key="@(context.Request.IpAddress)" /> placed inside the <outbound> section
- D<rewrite-uri template="@(context.Request.Url.Path.Replace("/api/v1", ""))" /> placed inside the <on-error> section
Answer
The correct policy fragments are the rewrite-uri policy to modify the request path and the rate-limit policy to limit incoming request rates, both placed in the inbound section.
The rewrite-uri policy and the rate-limit policy are inbound-processing directives. Placing them in the inbound block allows APIM to strip the API version prefix and verify rate limit quotas before routing the request to the backend service.
Step-by-Step Solution
Key Concept
Azure API Management inbound policy execution and structure