当你想登陆时
报错为:When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
开始我的代码为

如果你知道需要允许的具体域名,可以将它们明确列出,而不是使用 "*"
将allowedOrigins里面的内容改为你需要的地址就可以正常登录了

这个错误是由于在 Spring Boot 应用中配置 CORS(跨域资源共享)时,allowCredentials 设置为 true,但 allowedOrigins 包含了特殊值 "*"。根据 CORS 的规范,当 allowCredentials 为 true 时,allowedOrigins 不能包含 "*",因为浏览器不允许在 Access-Control-Allow-Origin 响应头中设置该值
4827

被折叠的 条评论
为什么被折叠?



