I try to modify the backend of our api management from resource to a webapp api. I have taken Use Azure Api Management as a passthrough as a reference.
the exposed api is: https://service-api-management.azure-api.net/api-name/operation-name
the actual api I want to call is: https://service-name.azurewebsites.net/api/Skills/Async/operation-name
apart from the uri, the request body and header should remain the same. So I have the below policy set up to change the uri. But the response is a html showing redirect.
Curiously about why it returns a html showing redirecting and how can I make the redirect work properly. Any input would be appreciated.
Policy:
<policies> <inbound> <base /> <set-backend-service base-url="https://service-name.azurewebsites.net" /> <rewrite-uri template="@(context.Request.Url.Path.Replace("/operation-name","/api/Skills/Async/operation-name"))" /> </inbound> <backend> <base /> </backend> <outbound> <base /> </outbound> <on-error> <base /> </on-error> </policies>
Response:
<!-- Copyright (C) Microsoft Corporation. All rights reserved. --> <!DOCTYPE html> <html> <head> <title>Redirecting</title> ......