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


相关推荐
漫霂8 分钟前
二叉树的翻转
java·数据结构·算法
语戚8 分钟前
力扣 51. N 皇后:基础回溯、布尔数组优化、位运算全解(Java 实现)
java·算法·leetcode·力扣·剪枝·回溯·位运算
程序猿阿越19 分钟前
Kafka4源码(三)Share Group共享组
java·后端·源码阅读
亦暖筑序20 分钟前
让AI不再"一本正经胡说八道":Spring AI RAG与VectorStore源码全解
java·源码阅读
蒙奇·D·路飞-24 分钟前
大模型时代下 Java 后端开发的技术重构与工程实践
java·开发语言·重构
ZK_H1 小时前
半导体工艺流程
java·c语言·开发语言·计算机网络·金融
Crazy________1 小时前
4.10dockerfile构建镜像
java·开发语言
阿维的博客日记1 小时前
锁消除和锁粗化
java·逃逸分析
云烟成雨TD1 小时前
Spring AI 1.x 系列【26】结构化输出执行流程
java·人工智能·spring
Slow菜鸟1 小时前
Spring Cloud 教程(四) | OpenFeign 的作用
后端·spring·spring cloud