API error on curl

We have an API that takes in POSTS containing XML from a number of various consumers.

We have built a curl that sends the post to the API. However, since upgrading to Yii2, this curl no longer gets a response unless you are on the same server. I’ve searched quite a bit and it appears to be related to csrf. So, I have disabled csrf with the following:

    'components' => [

        'request' => [

            'enableCsrfValidation' => false,


And I’ve also included the following in the controller:

    public function beforeAction($action)


        $this->enableCsrfValidation = false;

        return parent::beforeAction($action);


but the API will still not respond unless the request is made from the same server. Any ideas?

Did you use yii2 rest api


or did you develop a personalized solution?

This was ported over from Yii1, and this issue never happened.