关于withCredentials与状态码204

The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’. Origin ‘’ is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

http状态码变成产生204,前端报这个错误,解决方案有两个:
1.把withCredentials设置为false,不允许cookie
2.配置withCredentials=true, 后端需配置Access-Control-Allow-Credentials,Access-Control-Allow-Origin不能为*, 必须是地址

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章