A
A
alex5e2015-04-08 00:18:39
Yii
alex5e, 2015-04-08 00:18:39

Why does ForbiddenHttpException in Yii2 not render the view specified in the config?

Good day. I just can't understand why ForbiddenHttpException in Yii2 doesn't render the view specified in the config (site/error)?
Instead of view, I get the Error Name and Stack trace
In the code, everything is standard:
Controller

public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction'
            ]
        ];
    }

config
'errorHandler' => [
            'errorAction' => 'site/error',
        ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vyachin, 2015-04-08
@vyachin

Make sure all users have access to the error action in the SiteController

public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'actions' => ['error'],
                        'allow' => true,
                    ],
              ]
         ]
     }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question