Reputation: 441
I recently had cookies set to a specific sub-domain (i.e. "cookie1" set to sub1.mysite.com). I then changed the code to write the same name cookie to the domain (i.e. "cookie1 set to .mysite.com). Now if I hit a page without clearing cookies, I see the two cookies with the same name but scoped differently. So my question is when on sub1.mysite.com, which cookie will be read due to two cookies existing with same name and both in scope?
Thanks, MJ
Upvotes: 0
Views: 43
Reputation: 781068
The cookie with the most specific matching scope will be used. This allows a subdomain to override a domain-wide default cookie.
Upvotes: 1