Looking for some input on cookies and subdomain, I have already read [1][2] and [3].
If I set a cookie's domain to ".live.example.com"
Will the cookie be available to api.live.example.com?
I believe the answer is Yes.
Will the cookie be available to uat.example.com?
I believe the answer is No.
Additional Cookie Attributes will be set, these should be irrelevant, but I will mention in case someone sees them as relevant:
httpOnly - enabled
Secure - enabled
Expires - end of session
Under what conditions would the cookie not be sent to api.live.example.com (site has a valid SSL certificate, relevant if someone suggests site not in SSL mode as secure flag is set)?
Why do I ask this second question?
I have previously set a cookie to ".example.com". The cookie did not send to api.example.com via XMLHTTPRequest (js loaded from www.example.com), but opening another browser tab and doing a GET request to api.example.com the cookie is sent. Therefore, browser is making some decision here.
Have I read anything already?
Yes, I have reviewed the following question on stackoverflow, and also read RFC6265 sections 5.1.3 and 5.2.3. Nothing I have read suggests the approach will not work:
[1] Existing stackoverflow question - Cookies Subdomains Share cookie between subdomain and domain
[2] RFC State Management - Domain Matching https://www.rfc-editor.org/rfc/rfc6265#section-5.1.3
[3] RFC State Management - Domain Attribute https://www.rfc-editor.org/rfc/rfc6265#section-5.2.3