We have multiple clones of our main shop at www.mainsite.com for testing and developing.

e.g. test.mainsite.com, fbk.test.mainsite.com and isk.test.mainsite.com,

There is a big issues with the cookies...

Users can't work in all test sites at the same time (Frontend and Backend). They first have to delete all other cookies from the other domains before they can login.

The cookie domain is matching the domain name on every domain, on mainsite.com the cookie domain is mainsite.com on test.mainsite.com the cookie domain is test.mainsite.com and so on...

The cookie path is set to / everywhere


2 Answers 2


You dont have to delete cookies. You can use Chrome incognito mode or firefox private browsing.

Doesn't solve the issue but certainly makes working with it easier.

  • 1
    Thats not a good solution for the problem, it is only a workaround.
    – Black
    May 31, 2019 at 8:59

The cause of the bug is a wildcard selector in the cookie domain which is set for unknown reasons, e.g. .test.mainsite.com

So if you are logged in into test.mainsite.com, then a cookie with cookie domain .test.mainsite.com is set. If you now try to login to fbk.test.mainsite.com then it does not work, because a cookie with cookie domain .fbk.test.mainsite.com is getting set, but there is already a cookie with the cookie domain .test.mainsite.com which also matches fbk.test.mainsite.com because of the dot at the start which is a wildcard selector.

We solved it by changing the cookie domain of the main site from mainsite.com to www.mainsite.com and changing the subdomain names to this:

fbk.test.mainsite.com -> fbk-test.mainsite.com
isk.test.mainsite.com -> isk-test.mainsite.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.