Backbone & Slim PHP - Access-Control-Allow-Headers - Can GET information, can't POST it?

后端 未结 4 1590
北海茫月
北海茫月 2020-12-29 16:46

I\'m using Backbone and the Slim PHP framework. I\'m trying to post information to my API, however Access-Control-Allow-Headers keeps causing me problems...

My conso

4条回答
  •  独厮守ぢ
    2020-12-29 17:14

    Your OPTIONS request should be a 200 returning an empty response. Then the browser will send the real POST request.

    Also no need to add OPTIONS in Access-Control-Allow-Methods header.

    It seems your using authentication, why not add Access-Control-Allow-Credentials header too.

    For more informations check this code it may be helpful.

提交回复
热议问题