Yii2 default actions log me out... sometimes

So I’m using Yii2 basic app to develop affiliate system and default yii2 actions, the ones app starts with out of the box namely site/index and site/about log me out.

I’m using different layouts depending on whether you’re logged in or not and whenever I got to site/index (but not index, which displays exact same view they !) or site/about layout gets changed back to default main.php layout which is displayed when you’re not logged in.

Here’s the weird part - whenever I go to any other action (e.g. site/contact) I’m logged back in! When I check the request itself in the browser tools (the one that logs me out) it looks really weird and request headers are short and laconic and I can’t see any cookies there but I know very little about those things.

I’m also checking it with Yii::$app->user->isGuest, so it’s not layout bug, I’m actually not logged in while on those pages.

And the even weirder part is that sometimes it decideds to work just right and I have no idea what causes it (then later out of the blue it start flipping out again). There are no changes to the code between nice behaviour and crazy behaviour.

Here’s the code for the controller and actions I’m talking about but I don’t think it’ll be any useful (it’s the code you get out of the box when installing yii2 basic app):


    /**

     * @inheritdoc

     */

    public function behaviors()

    {

        return [

            'access' => [

                'class' => AccessControl::className(),

                'only' => ['logout'],

                'rules' => [

                    [

                        'actions' => ['logout'],

                        'allow' => true,

                        'roles' => ['@'],

                    ],

                ],

            ],

            'verbs' => [

                'class' => VerbFilter::className(),

                'actions' => [

                    'logout' => ['post'],

                ],

            ],

        ];

    }


    

    /**

     * Displays homepage.

     *

     * @return string

     */

    public function actionIndex()

    {

        $this->checkLayout();

        return $this->render('index');

    }


    /**

     * Displays about page.

     *

     * @return string

     */

    public function actionAbout()

    {

        $this->checkLayout();

        return $this->render('about');

    }

Thanks in advance for any help.

_______ EDIT

The above issue appears only on google chrome.

What do you do in "checkLayout"?