diff --git a/common/helpers/CorsCustom.php b/common/helpers/CorsCustom.php index c0e5d3f..0d67479 100644 --- a/common/helpers/CorsCustom.php +++ b/common/helpers/CorsCustom.php @@ -11,14 +11,14 @@ class CorsCustom extends Cors public function beforeAction($action){ - parent::beforeAction($action); + $result = parent::beforeAction($action); if (Yii::$app->getRequest()->getMethod() === 'OPTIONS') { -// Yii::$app->getResponse()->getHeaders()->set('Allow', 'POST GET PUT'); + Yii::$app->getResponse()->getHeaders()->set('Allow', 'POST GET PUT'); Yii::$app->end(); } - return true; + return $result; } diff --git a/customerapi/controllers/RestController.php b/customerapi/controllers/RestController.php index 0340189..502f83f 100644 --- a/customerapi/controllers/RestController.php +++ b/customerapi/controllers/RestController.php @@ -20,20 +20,20 @@ class RestController extends Controller { $behaviors = parent::behaviors(); - $auth = $behaviors['authenticator']; - unset($behaviors['authenticator']); +// $auth = $behaviors['authenticator']; +// unset($behaviors['authenticator']); - $behaviors['corsFilter'] = [ - 'class' => CorsCustom::class, - 'cors' => [ - // restrict access to - 'Origin' => ['https://botondfitness.hu'], - // Allow credentials (cookies, authorization headers, etc.) to be exposed to the browser - 'Access-Control-Allow-Credentials' => true, - ] - ]; +// $behaviors['corsFilter'] = [ +// 'class' => CorsCustom::class, +// 'cors' => [ +// // restrict access to +// 'Origin' => ['https://botondfitness.hu'], +// // Allow credentials (cookies, authorization headers, etc.) to be exposed to the browser +// 'Access-Control-Allow-Credentials' => true, +// ] +// ]; - $behaviors['authenticator'] = $auth; +// $behaviors['authenticator'] = $auth; $behaviors['authenticator'] = [ 'class' => JwtHttpBearerAuth::class, 'auth' => [$this, 'auth'],