Yii2 rest Method Not Allowed?

config https://github.com/des1roer/yii2test/blob/master/config/web.php

api module https://github.com/des1roer/yii2test/tree/master/modules/api

how repair?

Is this missing from your config?

http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html#configuring-url-rules

[‘class’ => ‘yii\rest\UrlRule’, ‘controller’ => ‘api/unit’], don`t work

If anyone hits same issue make sure that you have request enabled to handle JSON


'request' => [

	'parsers' => [

    	'application/json' => 'yii\web\JsonParser',

	]

]

It seems you can not do a delete when you don’t have a token set in the rules. For some reason the delete method is then not allowed.