Cookie Validation Error on Production

I am trying to go live on a production server but I am getting the following error:

An Error occurred while handling another error:\nexception ‘yii\\base\\InvalidConfigException’ with message 'yii\\web\\Request::cookieValidationKey must be configured with a secret key

I added


$config = [

    'components' => [

        'request' => [

            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation

            'cookieValidationKey' => 'xxxxx',




return $config;

in /backend/config/main-local.php and I tried adding it to /backend/config/web.php but got an error when I tried to put it in web

My development environment is working fine, but I cannot get production to work because of this issue. Replacing key with xs for this post

I solved this problem. I had missed adding main-local to my index file in production. Still having issues, but this one is solved.