Yii2 RESTful with Authorization Bearer header needs OPTIONS call ... how to handle it ?


I’m making a call with $.ajax command adding the Header of Authorization Bearer and my access token. My method is POST in this case.

As I can read here:

when you do that, (browser?) makes an extra call to the same URL with OPTIONS method. I don’t know why, but yes, it does. My console shows a call to OPTIONS instead of POST, so something (jquery or browser) is changing (adding) this.

How can I handle this in Yii2 ? Do I need to say Yii in urlManager config to handle all OPTIONS calls ? To where ? Which response ?

Thank you

I’m doing right now the documentation of a RESTFUL server library, MAYBE it can help you:

looks great ! thank you very much