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 path is not set to root #1

Open
leandroprz opened this issue Mar 17, 2021 · 0 comments
Open

Cookie path is not set to root #1

leandroprz opened this issue Mar 17, 2021 · 0 comments

Comments

@leandroprz
Copy link

I was having issues with the cookie path and noticed that when clicking on Accept the cookie would be saved in the current path. So for example if I was browsing domain.com/blog/ the cookie would be saved for that path instead of /. Meaning everytime I visited another URL I got the popup again even though I already clicked on Accept.

I fixed it by adding path=/ to line 10 in app.js:

document.cookie = `${item}=${value};path=/`

It is working fine, but I'm not sure if that's the best solution. Just wanted to share it in case somebody else was experiencing the same issue.

Thank you for the tutorial and the code!

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

1 participant