I have Application Insights configured on both the front and back-end of my website, which operate on different sub-domains (let's say
The cookie containing the user information set by
setAuthenticatedUserContext is stored by AI with the cookie domain set to
www.mydomain.com. When I make a call to
api.mydomain.com the cookie is not included, and therefore the credentials I set are not associated with any AI data logged by the API.
My API has
Access-Control-Allow-Credentials set to
true, and the front-end has
withCreditials set to
true on the XHR object.
Can I get AI to set a different cookie domain, or is there some other issue at play here stopping the user information reaching the API?
Update: I notice Google Analytics sets a cookie with the domain set simply to
.mydomain.com, and this cookie information is included with calls to my API.