B
B
bagos2019-02-01 16:01:11
Yii
bagos, 2019-02-01 16:01:11

Why does the cors filter only work on *?

If origin = * , then everything loads, but if I write the domain, then the page is blocked, why?

public function behaviors()
{
    return [
        'corsFilter' => [
            'class' => \yii\filters\Cors::className(),
            'cors' => [
                'Origin' => ['https://test.test.ru'],
                'Access-Control-Request-Method' => ['POST'],
            ],

        ],
    ];
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Cherepanov, 2019-06-22
@xakplant

You need to specify domains from which requests can be made in the Access-Control-Allow-Origin header. Origin is the request header
More about CORS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question