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


相关推荐
靠沿5 分钟前
Java数据结构初阶——Collection、List的介绍与ArrayList
java·数据结构·list
e***71675 分钟前
Spring Boot项目接收前端参数的11种方式
前端·spring boot·后端
程序猿小蒜7 分钟前
基于springboot的的学生干部管理系统开发与设计
java·前端·spring boot·后端·spring
q***563833 分钟前
Spring容器初始化扩展点:ApplicationContextInitializer
java·后端·spring
q***518939 分钟前
SpringCloud系列教程:微服务的未来(十四)网关登录校验、自定义过滤器GlobalFilter、GatawayFilter
java·spring cloud·微服务
go__Ahead1 小时前
【Java】线程池源码解析
java·juc
菜鸟‍1 小时前
【后端学习】MySQL数据库
数据库·后端·学习·mysql
wyhwust1 小时前
数组----插入一个数到有序数列中
java·数据结构·算法
专注于大数据技术栈1 小时前
java学习--final
java·开发语言·学习
Codebee1 小时前
30 分钟落地全栈交互:OneCode CLI+SVG 排课表实战
后端