Session not saving when moving from ssl to non-ssl

后端 未结 7 1093
我在风中等你
我在风中等你 2020-12-31 15:17

I have a login screen that I force to be ssl, so like this: https://www.foobar.com/login then after they login, they get moved to the homepage: https://www.foobar.com/dashba

7条回答
  •  粉色の甜心
    2020-12-31 15:36

    You can read more in documentation CakePHP at http://book.cakephp.org/2.0/en/development/sessions.html CakePHP’s defaults to setting session.cookie_secure to true, when your application is on an SSL protocol. If your application serves from both SSL and non-SSL protocols, then you might have problems with sessions being lost. If you need access to the session on both SSL and non-SSL domains you will want to disable this:

    You open file Config/core.php and add as bellow

    Configure::write('Session', array(
        'defaults' => 'php',
        'ini' => array(
            'session.cookie_secure' => false
        )
    ));
    

    Now you can switch http and https that not lose session :)

提交回复
热议问题