Session data removed on redirect

The code below creates an endless loop.

Can anyone please explain how I make the session data persist on redirect ?

I have checked and there is not data being transferred, but the session data is set inside searchuser correctly.




    public function actionSearchUser()

    {

	$session = \Yii::$app->session;

	$session->open();

		

	$session->set('admin.currentuser.id', "This worked out ok");

		

        return $this->redirect(['site/modify-user']);

    }


    public function actionModifyUser()

    {

		

		$session = \Yii::$app->session;

		$session->open();


		if( !($session->has('admin.currentuser.id')) ) 

		{

			return $this->redirect(['site/search-user']);

		}

		else return $this->render('modifyUser');

    }



And here is where I setup my session:


    'session'=>array(

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

        'name' => 'SESSIONNAME',

        'timeout' => 86400,

        'savePath' => '/path/to/sessions',

        'useCookies' => true,

        'cookieParams' => array(

            'lifetime' => 86400,

            'path' => '/',

            'domain' => 'localhost', 

        ),

    ),

My problem was the domain (I know, I’m stupid). I had a custom domain (n099y.local) so I needed to change domain to that and everything was fine. It was showing all the correct session data on the page until I went to another page when the data was again missing.

What did you have to change domain too?

One with https:// ?