Open ferdoran opened 5 years ago
I don't think this is a bug, but expected behavior from browsers. When setting a cookie that should be accessible from both a domain and its subdomains, the domain is supposed to have a period prepended. See https://stackoverflow.com/questions/3089199/can-subdomain-example-com-set-a-cookie-that-can-be-read-by-example-com.
Sure
When I set a cookie with domain
example.com
fromfoo.example.com
the domain of the cookie is being set to.example.com
.Cookies.set('mycookie', 'myvalue', {domain: 'example.com'}
will result in:"mycookie=myvalue; Domain=.example.com; Path=/"
However If I want to remove it with the same attributes, the cookie is not removed:
Cookies.remove('mycookie', {domain: 'example.com'}
Prepending a period to the domain fixed it for me:
Cookies.remove('mycookie', {domain: '.example.com'}