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


相关推荐
二十雨辰3 分钟前
[Spring]-认识Spring
java·数据库·spring
eguid_18 分钟前
WebRTC流媒体传输协议RTP点到点传输协议介绍,WebRTC为什么使用RTP协议传输音视频流?
java·网络协议·音视频·webrtc·实时音视频
码农娟8 分钟前
根据文件路径获取base64照片
java
手机忘记时间14 分钟前
在R语言中如何将列的名字改成别的
java·前端·python
苹果酱056715 分钟前
[数据库之十一] 数据库索引之联合索引
java·vue.js·spring boot·mysql·课程设计
老兵发新帖21 分钟前
NestJS 框架深度解析
后端·node.js
zhojiew21 分钟前
istio in action之流量控制与路由
java·数据库·istio
D_aniel_36 分钟前
排序算法-归并排序
java·排序算法·归并排序
码出钞能力1 小时前
对golang中CSP的理解
开发语言·后端·golang
可儿·四系桜1 小时前
WebSocket:实时通信的新时代
java·网络·websocket·网络协议