bug fixing
This commit is contained in:
25
common/helpers/CorsCustom.php
Normal file
25
common/helpers/CorsCustom.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace common\helpers;
|
||||
use Yii;
|
||||
|
||||
use yii\filters\Cors;
|
||||
|
||||
|
||||
class CorsCustom extends Cors
|
||||
{
|
||||
|
||||
public function beforeAction($action){
|
||||
|
||||
parent::beforeAction($action);
|
||||
|
||||
if (Yii::$app->getRequest()->getMethod() === 'OPTIONS') {
|
||||
Yii::$app->getResponse()->getHeaders()->set('Allow', 'POST GET PUT');
|
||||
Yii::$app->end();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user