Session Via Redis For Multi-Domain Login

Hi,

Not sure if this is intended, I tried enable redis for session and subdomain login session seems to be lost. I tried removing redis\session and it will work again.

My config is as below.




'session'=>[

            'cookieParams'=>[

                'domain'=>'.xxx.com'

            ],


            'class' => 'yii\redis\Session',

            'redis' => [

                'hostname' => 'localhost',

                'port' => 6379,

                'database' => 5,

            ],

        ],

        

        'redis' => [

            'class' => 'yii\redis\Connection',

            'hostname' => 'localhost',

            'port' => 6379,

            'database' => 0,

        ],

'user' => [

            'identityClass' => 'common\models\User',

            'enableAutoLogin' => true,

            'authTimeout'=>(60*60*24*30),

            'identityCookie'=>[

                'name' => '_identity',

                'httpOnly' => true,

                'domain'=>'.xxx.com',

                'path'=>'/'

            ],

        ],



replaced my domain for xxx.com

Am I doing it right?

Seems to be so. I don’t see a reason for losing a session.

Its not working on my side as well. Does any any one find answer ?

I got this working.

‘session’ => [
‘class’ => ‘yii\redis\Session’,
‘keyPrefix’ => ‘_auth’, //Important for all sub domain configurations
‘redis’ => [
‘hostname’ => ‘localhost’,
‘port’ => 6379,
‘database’ => 1,
],
‘name’ => ‘sid’,
‘timeout’ => 31104000,
‘cookieParams’ => [
‘domain’ => $params[‘identityCookie’],
‘httpOnly’ => true,
],
],