3

I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder).

5

The problem is that the basepath changes each time you deploy (Capistrano uses versioned release directories). The basepath is used to generate a session key, which is invalidated each time a new deployment is made.

The answer is to add the appId parameter to config/general.php. The docs give a good explanation

The application ID, which is used for things like storing data caches and user sessions. If it’s not set, Craft will automatically generate one based on the server path. Setting it will help avoid the loss of data caches and user sessions when Craft is deployed using a deployment script that will store Craft in an inconsistent location, such as Capistrano.

So add this to general.php:

'appId' => 'chooseyourownrandomstring',
  • 1
    Man. I've been slamming my head against the wall on this one for a few days. And there it is. Thanks! – Mats Mikkel Rummelhoff Oct 15 '16 at 18:13

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.