Azure APIM

Abhay Chandramouli 966 Reputation points
2022-10-28T05:21:59.993+00:00

Hi,
I am trying to redirect from APIM to browser using 302 in APIM. I am unable to set cookie in chrome but I am able to do the same in Safari.
Is there something I am missing.. ?

Thanks

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

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 69,841 Reputation points
    2022-10-28T11:15:18.14+00:00

    @Abhay Chandramouli Thanks for reaching out. Can you please share the policy that you are leveraging. To set the cookie header you can leverage the below policy.
    Set-Cookie header is supported in chrome but Starting with Chrome 52 and Firefox 52, insecure sites (http:) can't set cookies with the Secure attribute anymore.

    Let me know if the below works for you.

    <set-header name="Set-Cookie" exists-action="override">  
             <value>@{  
                   var cookie = context.Response.Headers.GetValueOrDefault("Set-Cookie","");  
                   return cookie. Replace("path=/;", "path=/myNewPath;");  
                }  
            </value>  
    </set-header>  
    
    0 comments No comments