Allow CORS in yii2?

How to solve CORS issue in yii2? Please help.

https://www.yiiframework.com/doc/api/2.0/yii-filters-cors

Not able to solve issue

What do you have so far?

Same problem here.
It’s definitely something with yii configuration, because testing the index.php gives me no problem.
Somewhere in the yii configuration gives me a Cors problem.
I’m trying to call from localhost:4200 angular to localhost:443.
Again, from the index.php project file (initial file), I get no problem.
I tried configuring behaviors with corsFilter and didn’t succeed.
Any solution, anybody?

I want to update that I solved my problem.
The Cors error message would come also when the time of the api call is too long.
For example, if you use a remote database.
After a long time of waiting you might get a Cors error message, instead of the result.

2 Likes