springcloud-gateway升级版本allowedOrigins要改allowedOriginPatterns

前言

报错:

powershell 复制代码
java.lang.IllegalArgumentException: When allowCredentials is true,

allowedOrigins cannot contain the special 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.

原因:springboot升级2.6.0后所出现的问题

解决方法:将.allowedOrigins 替换成. allowedOriginPatterns 即可。

如下图:

ps:这是2.3时代的配置,现在不叫这个了,要用:

相关推荐
艾莉丝努力练剑1 天前
【C++:异常】C++ 异常处理完全指南:从理论到实践,深入理解栈展开与最佳实践
java·开发语言·c++·安全·c++11
武子康1 天前
Java-184 缓存实战:本地缓存 vs 分布式缓存(含 Guava/Redis 7.2)
java·redis·分布式·缓存·微服务·guava·本地缓存
小马爱打代码1 天前
Spring Boot:模块化实战 - 保持清晰架构
java·spring boot·架构
小坏讲微服务1 天前
SpringBoot4.0整合knife4j 在线文档完整使用
java·spring cloud·在线文档·knife4j·文档·接口文档·swagger-ui
8***Z891 天前
springboot 异步操作
java·spring boot·mybatis
i***13241 天前
Spring BOOT 启动参数
java·spring boot·后端
坚持不懈的大白1 天前
后端:SpringMVC
java
IT_Octopus1 天前
(旧)Spring Securit 实现JWT token认证(多平台登录&部分鉴权)
java·后端·spring
kk哥88991 天前
Spring详解
java·后端·spring
S***26751 天前
Spring Cloud Gateway 整合Spring Security
java·后端·spring