Hello, All,
I’m using CURL requests in my Yii2 web application. They need switched off CSRF protection. The issue here is that the framework makes an instance of yii\web\Controller, before it makes an instance of my controller (for example app\controllers\GameController). The reason of this behavior is the two urlManager properties: “‘enableStrictParsing’ => true”, “‘showScriptName’ => false”. So, I cannot redeclare “public function beforeAction($action)” method for switching off CSRF protection ($this->enableCsrfValidation = false;) or (directly return “true” on specific controller, action, caller IP).
My question is:
- How can I make a controller, which extends yii\web\Controller /I’ll call it “app\controllers\ApplicationController”/ and which the framework always calls instead of yii\web\Controller?
I have read many tutorials, forums, etc. I have not found my answer.
Thank you in advance!
Hristo Hristov