I have an backend API, say:
GET https://bk.my.com/api/store/goods
and I use Azure API management as proxy. here is the main settings for my api "My Test API"
Web Service URL: https://bk.my.com/
API URL suffix :
Base URL
https://bk-xxx.azure-api.net
add API operation, here is the operation settings (Frontend, I only use this, other settings keep default)
Display Name: Get all goods
Name : get-all-goods
URL : GET /api/store/goods
it works. since
https://bk-xxx.azure-api.net/api/store/goods => https://bk.my.com/api/store/goods
now I need to add a new version for this API. Here is the v2 api in the backend.
GET https://bk.my.com/api/v2/store/goods
I create a new version api name 'v2' by using header classification
GET https://bk-xxx.azure-api.net/[operation]
api-version: v2
so in "My Test API", there are 2 versions
>My Test API <operation> <frontend> <inbound>
Original -> get-all-goods -> GET /api/store/goods
v2 -> get-all-goods -> GET /api/store/goods <inbound>
<base />
<rewrite-uri template="/api/v2/store/goods" />
</inbound>
when I test v2 api, but it does't work, trace says:
configuration (0 ms)
{
"message": "Unable to identify Api or Operation for this request. Responding to the caller with 404 Resource Not Found."
}
then I try to fix v2 api operation by removing rewrite-uri
>My Test API <operation> <frontend> <inbound>
Original -> get-all-goods -> GET /api/store/goods
v2 -> get-all-goods -> GET /api/v2/store/goods
it works now.
so My question is why rewrite-uri do not work ?