I have an API in APIM. When my API is called, I want to remove one of the query parameters from the URL ("ax-ky" in the code) and keep the rest (Page). I was thinking policies in APIM would help me remove "ax-ky". I've tried the solutions here and here but they have not been working with my API. After implementing the new inbound policy below, I get 500 status code with the message "Internal server error".
Currently my code is in the "Inbound" policy, shown below:
<set-query-parameter name="ax-ky" exists-action="override">
<value>@(context.Product.Name)</value>
</set-query-parameter>
<rewrite-uri template="_/_?Page={Page}" />
Edit: Adding screenshot of Trace "set-query-parameter" --> Query parameter is removed in set-query-parameter but not when the URL is returned to the user.