Разрабатываю сайт на YII2, с фронтенда делаю CORS запрос OPTIONS на action email. В ответе получаю 302.
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['login', 'remind', 'logout', 'phone-confirmation', 'registration', 'password', 'phone', 'email', 'payments', 'templates', 'template', 'email-confirmation', 'feed', 'get-points', 'get-count-payment'],
'rules' => [
[
'actions' => ['phone-confirmation', 'email-confirmation', 'get-points', 'feed', 'login', 'get-count-payment'],
'allow' => true,
'roles' => ['?', '@'],//all users
],
[
'actions' => ['remind', 'registration'],
'allow' => true,
'roles' => ['?'],//only guests
],
[
'actions' => ['password', 'phone', 'email', 'payments', 'templates', 'template', 'logout'],
'allow' => true,
'roles' => ['@'],//only logged users
]
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'login' => ['post', 'options'],
'remind' => ['post', 'options'],
'logout' => ['get'],
'phone-confirmation' => ['post', 'options'],
'registration' => ['post', 'options'],
'password' => ['post', 'options'],
'phone' => ['post', 'options'],
'email' => ['post', 'options'],
'email-confirmation' => ['get'],
'payments' => ['get'],
'templates' => ['get'],
'template' => ['post', 'put', 'delete', 'get', 'options'],
'get-points' => ['get'],
'get-count-payment' => ['get'],
'feed' => ['post', 'options'],
],
],
'corsFilter' => [
'class' => Cors::className(),
'cors' => [
'Origin' => ['*'],
'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'OPTIONS'],
'Access-Control-Request-Headers' => ['*'],
'Access-Control-Allow-Credentials' => true,
]
],
];
}
Как настроить правильную обработку запроса с методом OPTIONS в YII2?
Разрешены ли CORS запросы методом OPTIONS для авторизованных пользователей