policy to override backend service ost value

Upasana Ghosh 351 Reputation points
2022-11-07T13:41:56.69+00:00

How to override the backend service host value in apim policy ?

Host ( the header name ) -- it should override the backend service host value

is the below condition policy sufficient enough to do the above operation ?
<choose>
<when condition="@(context.Request.Url.Query.GetValueOrDefault("version") == "2013-05")">
<set-backend-service base-url="http://contoso.com/api/8.2/" />
</when>
</choose>

@MuthuKumaranMurugaachari-MSFT

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,447 questions
0 comments No comments
{count} votes

Accepted answer
  1. Roderick Bant 2,056 Reputation points
    2022-11-07T19:22:38.253+00:00

    For overriding the Host value you would typically override the host header. This documentation describes how you can use <set-header> to override the host header value.

    for example:

       <set-header name="Host" exists-action="override">  
           <value>contoso.com</value>  
       </set-header>  
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.