0

I am setting explicit cookie domain in the config, as my Magento site is on www.mydomain.com and I want to share cookies with a subdomain sub.mydomain.com.

If I leave Magento to set its default cookie domain it will use .www.mydomain.com, which will not share with sub.mydomain.com, so I am setting a manual cookie domain to .mydomain,com (path: "web/cookie/cookie_domain", scope: "default", value: ".mydomain.com").

However, I then get the age-old problem of not being able to log into admin or frontend. I put in my username and password but I do not even get an error back - I'm just returned to the login page.

The conventional Magento wisdom is to clear cookies and make sure that you don't have a manual cookie domain set... except that I need a manual cookie domain set.

The domain of the cookie stored is correct as ".mydomain.com" and it is being shared as expected with the sub-domain. But I can't login. What am I doing wrong?

0

By the time I finished writing this I spotted my error:

Magento expects the cookie domain to be entered without the initial "."

By using "mydomain.com" as my manual cookie domain, I can log in again. On setting the cookies, Magento prefixes a "." so the cookies I see in my browser are ".mydomain.com" and they work exactly the same across sub-domains, but it also recognises the cookies so that login works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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