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


相关推荐
ciku4 分钟前
Spring AI Starter和文档解读
java·人工智能·spring
柏油5 分钟前
MySQL 字符集 utf8 与 utf8mb4
数据库·后端·mysql
程序猿阿越14 分钟前
Kafka源码(三)发送消息-客户端
java·后端·源码阅读
javadaydayup16 分钟前
Apollo 凭什么能 “干掉” 本地配置?
spring boot·后端·spring
似水流年流不尽思念16 分钟前
Spring MVC 中的 DTO 对象的字段被 transient 修饰,可以被序列化吗?
后端·面试
武子康17 分钟前
大数据-70 Kafka 日志清理:删除、压缩及混合模式最佳实践
大数据·后端·kafka
whitepure19 分钟前
万字详解Java中的运算
java
故此26620 分钟前
synchronized原理
后端
似水流年流不尽思念20 分钟前
为啥 HashMap 中的 table 也被 transient 修饰?其目的是什么?
后端·面试