Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie not removed with same attributes #6

Open
ferdoran opened this issue Jul 2, 2019 · 2 comments
Open

Cookie not removed with same attributes #6

ferdoran opened this issue Jul 2, 2019 · 2 comments

Comments

@ferdoran
Copy link

ferdoran commented Jul 2, 2019

When I set a cookie with domain example.com from foo.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'}

@theodorejb
Copy link
Owner

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.

@carlosdavid0
Copy link

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants