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


相关推荐
vx-Biye_Design4 小时前
SSM伴侣动物伴护星小程序06330-计算机课程设计、毕业设计
spring boot·后端·elasticsearch·小程序·架构·课程设计·idea
2分钟速写快排6 小时前
什么是 RAG?如何用 RAG 实现一个用户记忆?
前端·后端·ai编程
面向Google编程6 小时前
Apache Iceberg Variant 类型:v3 半结构化数据不再「二选一」
大数据·后端
lhldsg7 小时前
全民健身解决方案小程序开发:从0到1的技术实战
java·数据库·需求分析
jason成都7 小时前
Spring WebFlux 适配达梦新方案|dm‑r2dbc:Netty 异步传输的实验性 R2DBC 驱动
java·后端·spring
泡海椒7 小时前
内置SPI函数库详解:JQuick-Java Builtin工具类实战用法
java·开发语言·python
辰烨chenye7 小时前
LeetCode Hot 100 题解 · 二分篇
java·算法·leetcode
小羊没烦恼!8 小时前
Hello Web API系列教程——Web API与国际化
java·服务器·前端·javascript·php
北岛贰8 小时前
迷茫焦虑期,我做了一个带支付带官网的 AI 聊天虚拟恋人 App
前端·人工智能·后端
小荷才露尖尖角,早有蜻蜓立上头9 小时前
过滤器的4种创建方式
java