CORS requests with session/cookie

后端 未结 2 767
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 08:06

My application has a PHP server and a client (a JS single-page app). They are separate projects and deployed in different domains. The client consumes a RESTful API exposed

2条回答
  •  没有蜡笔的小新
    2020-12-19 08:34

    I thought that once the session was created the browser would automatically send the right Cookie header in the asynchronous API calls

    Not for cross-domain requests for CORS-enabled ressources (which seems to be the case here, if I understand your described setup correctly.)

    To make that happen, you need to set the withCredentials flag.

提交回复
热议问题