I'm currently migrating a site from Magento to 1.8.1. I'm following the instructions outlined on the Magento site, so I've created a development account and ported over my theme, extensions and a copy of the database.

I'm facing a strange problem in that the frontend cookie is not being generated until a user tries to login - so on first login attempt (successful or otherwise), Magento redirects to the login page. After the first attempt, login and other site functionality behave as expected.

I have been through my theme and ensured any forms I have feature the form key introduced in 1.8 - but my login template uses the the base default Magento 1.8 anyhow. I've also tried switching to the default theme, with same behaviour.

There are no core overrides in the install, and I've tried disabling all extensions. Same result.

I've tried playing with the cookie domain value in the admin area - leaving it blank, specifically the sub-domain or for the whole domain. Behaviour is the same.

If I visit the current site I get frontend cookie set on first page load, as expected.

Any ideas what's happening or what I can do to fix it?

  • As I've said in the edit above, this is not a duplicate - the issue is not the one referenced in the 'Customer Can't log in' question. I have the solution and will post when this gets reopened.
    – BrynJ
    May 19, 2014 at 9:58
  • Nominated for reopening. Needs one more or a mod now. :)
    – davidalger
    May 19, 2014 at 14:59
  • 2
    I have voted to reopen. Please self-answer or provide more clarity as to why this is not a duplicate. Thanks!
    – philwinkle
    May 19, 2014 at 15:29

1 Answer 1


In the end I found this issue related to server configuration. The staging site was on a server with Varnish installed.

Varnish was set to ignore the staging site url in the configuration, but it was still interfering with the cookie creation somehow - despite not otherwise caching the site in any way.

Using a non-standard port, to bypass Varnish completely, immediately resolved the issue.

I'm still investigating why Varnish caused this issue - if and when I have more information I will update this answer.

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.