Spring Boot 2.0 解决跨域问题:WebMvcConfiguration implements WebMvcConfigurer

When allowCredentials is true, allowedOrigins cannot contain the special value "*"since that cannot
复制代码
When allowCredentials is true, allowedOrigins cannot contain thespecial 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.

出现该问题是跨域问题,当allowCredentials为true时,allowingOrigins不能包含特殊值" *",因为无法在" Access-Control-Allow-Origin"响应标头上设置。

处理方法是:首先找打你后端跨域设置文件,将方法中的addAllowedOrigin("")替换成addAllowedOriginPattern("")


相关推荐
苍何15 小时前
实测 GLM5.1 高速版,快到离谱还不掉智商
后端
苍何15 小时前
企业微信新出的 AI 能力,用完想安利给全公司
后端
苍何15 小时前
每月省一千,我雇了支 7×24 云端 Agent 团队
后端
苍何15 小时前
12 天 4.2K 的 Star,我的 GPT-image2 开源项目火了!
后端
苍何15 小时前
我的 AI 视频团队入职腾讯了!
后端
苍何15 小时前
终于找到解决手机消息轰炸的 AI 神器,有点离谱...
后端
楼田莉子15 小时前
C++17新特性:optional/variant/any/string_view
c++·后端·学习
risc12345615 小时前
DocumentsWriterDeleteQueue 的核心设计思想
java·全文检索·lucene
风味蘑菇干15 小时前
Stream基础题目
java·算法
2501_9327502615 小时前
Java反射机制基础入门
java·开发语言