Disable Yii Session For Given Controller


i would like to disable session/cookie creation for just one controller.

it is possible ?



try this

configure the config/main.php

set session like that for the specific controller

'session' => array (

    'autoStart' => false,


But what exactly you want to do ?

if i add this code in my config file i can’t use the login form anymore

'session' => array (

    'autoStart' => false,


in my application i have a controller called ApiController with ips accessRules.

how can i disable session/cokies only for ApiController actions

You have to merge the above configure by condition

see how to do that in config/test.php, merge array when the request referenced to specific controller

Check this tip: (put in your config/main.php)

$params = (explode('/', $_SERVER['PATH_INFO']));

if ($params[0] == 'yourcontrollername') //I don't remember, maybe $params[0] or something like that

...merge array config