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("")


相关推荐
IT_陈寒几秒前
React的useEffect依赖数组把我坑惨了,真相其实很简单
前端·人工智能·后端
Oneslide1 小时前
ubuntu 手动安装claude
后端
GetcharZp9 小时前
玩转 Linux 机器视觉:手把手带你搞定 Ubuntu 下海康工业相机 C++ SDK
后端
星星在线12 小时前
MusicFree:一个「All in One」的个人音乐服务器,让听歌回归简单
前端·后端
IT_陈寒13 小时前
Redis的SETNX并发问题让我加了三天班
前端·人工智能·后端
demo007x14 小时前
Docling 文档转换以及技术架构分析
前端·后端·程序员
NE_STOP15 小时前
Vide Coding--AI编程工具的选择
java
袋鱼不重15 小时前
我的神奇同事,AI 用多了居然写了个 Open In Codex
前端·后端·ai编程
用户83562907805115 小时前
使用 Python 操作 Word 内容控件
后端·python
像我这样帅的人丶你还15 小时前
啥? 前端也要会干Java?🛵🛵🛵
后端