bug fixing
This commit is contained in:
parent
ae1640c444
commit
f9c845f722
@ -11,14 +11,14 @@ class CorsCustom extends Cors
|
|||||||
|
|
||||||
public function beforeAction($action){
|
public function beforeAction($action){
|
||||||
|
|
||||||
parent::beforeAction($action);
|
$result = parent::beforeAction($action);
|
||||||
|
|
||||||
if (Yii::$app->getRequest()->getMethod() === 'OPTIONS') {
|
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();
|
Yii::$app->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,20 +20,20 @@ class RestController extends Controller
|
|||||||
{
|
{
|
||||||
$behaviors = parent::behaviors();
|
$behaviors = parent::behaviors();
|
||||||
|
|
||||||
$auth = $behaviors['authenticator'];
|
// $auth = $behaviors['authenticator'];
|
||||||
unset($behaviors['authenticator']);
|
// unset($behaviors['authenticator']);
|
||||||
|
|
||||||
$behaviors['corsFilter'] = [
|
// $behaviors['corsFilter'] = [
|
||||||
'class' => CorsCustom::class,
|
// 'class' => CorsCustom::class,
|
||||||
'cors' => [
|
// 'cors' => [
|
||||||
// restrict access to
|
// // restrict access to
|
||||||
'Origin' => ['https://botondfitness.hu'],
|
// 'Origin' => ['https://botondfitness.hu'],
|
||||||
// Allow credentials (cookies, authorization headers, etc.) to be exposed to the browser
|
// // Allow credentials (cookies, authorization headers, etc.) to be exposed to the browser
|
||||||
'Access-Control-Allow-Credentials' => true,
|
// 'Access-Control-Allow-Credentials' => true,
|
||||||
]
|
// ]
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$behaviors['authenticator'] = $auth;
|
// $behaviors['authenticator'] = $auth;
|
||||||
$behaviors['authenticator'] = [
|
$behaviors['authenticator'] = [
|
||||||
'class' => JwtHttpBearerAuth::class,
|
'class' => JwtHttpBearerAuth::class,
|
||||||
'auth' => [$this, 'auth'],
|
'auth' => [$this, 'auth'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user