cookieconsent
cookieconsent copied to clipboard
[Bug]: Subdomain changes in the domain settings can lead to breaking the bar
Expected Behavior
If user set consent on some particular domain/subdomain, the cookie bar should read from the relevant cookie.
Current Behavior
The cookie bar gets the first cookie it gets, which can lead to a broken cookie bar (still showing).
Steps to reproduce
- Set domain to your domain like
www.example.com
- Store consent (accept all)
- Change it to
.example.com
- Store consent (accept necessary)
or vice versa
Proposed fix or additional info.
It's related to how cookies are stored and read, see https://stackoverflow.com/questions/4056306/how-to-handle-multiple-cookies-with-the-same-name/24214538#24214538
https://github.com/68publishers/cookie-consent/issues/79#issuecomment-2103802928
I'm not sure if this can be fixed at the cookie reading level. If not, at least a mention in the documentation would be good, as this can break the site - the bar will show up on every request, or the changes won't be saved and you'll lose analytics. To be precise, the changes will be saved, but they will be read again from the bad one - the original one.
Version
all
On which browser do you see the issue?
No response