E
E
EgoriusRus2019-12-25 19:43:15
PHP
EgoriusRus, 2019-12-25 19:43:15

Cors. Behavior on https?

There is an api written in yii2 that communicates with the front on vue
Such a disaster. They are on different domains, that's why cors knocks out. But the problem was solved by setting KORS inside the controller. And everything would be fine as long as the server was on the localhost. After the transfer, the problem with the cors resumed.
What could be the problem? In https?
Let me know who faced

$behaviors['corsFilter'] = [
            'class' => \yii\filters\Cors::className(),
            'cors' => [
                'Origin' => ['*'],
                'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
                'Access-Control-Request-Headers' => ['*'],
                'Access-Control-Allow-Credentials' => null,
                'Access-Control-Max-Age' => 86400,
                'Access-Control-Expose-Headers' => ['X-Pagination-Current-Page'],
            ],
        ];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egor_nullptr, 2019-12-25
@egor_nullptr

The response must have an Access-Control-Allow-Origin header .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question