伙伴匹配系统第五集跨域携带cookies报错
前端配置了myAxios.defaults.withCredentials=true;//让ajax携带cookie 之后要是还是报错在后端的controller中加上注解: @CrossOrigin(origins = "http://localhost:5173",allowCredentials = "true")
解释
@CrossOrigin(origins = "http://localhost:5173",allowCredentials = "true")
- 前半部分是允许该地址进行跨域 origins = "http://localhost:5173"
- 后半部分是允许携带凭证 allowCredentials = "true"
- allowCredentials默认值是false
评论
相关内容
0个评论
全部评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
