【发布时间】:2018-02-20 14:37:52
【问题描述】:
- 我使用 fetch 发布跨域请求,响应成功,带有 set-cookie 标头:
- 然后我通过get请求获取数据,却发现get请求没有cookie请求头。代码为:
我很确定 cookie 设置为域 jdcf88.com。 3. 不知道为什么获取请求没有cookie头,服务器设置了Access-Control-Allow-Credentials为true,凭证为include。
【问题讨论】:
我很确定 cookie 设置为域 jdcf88.com。 3. 不知道为什么获取请求没有cookie头,服务器设置了Access-Control-Allow-Credentials为true,凭证为include。
【问题讨论】:
您的服务器以 Access-Control-Allow-Origin:* 响应,这与包含凭据不兼容。尝试将您的来源明确设置为客户的地址。
所以你的服务器应该响应 Access-Control-Allow-Origin:http://localhost:8080(或任何您的客户端地址)
【讨论】: