SpringBoot升级2.4.0所出现的问题:
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.

解决方案:
跨域配置报错,将.allowedOrigins替换成.allowedOriginPatterns即可。
调整前:

package com.course.server.config;import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configuration
public class CorsConfig implements WebMvcConfigurer {@Overridepublic void addCorsMappings(CorsRegistry registry) {// 设置允许跨域的路由registry.addMapping("/**")// 设置允许跨域请求的域名.allowedOrigins("*").allowedHeaders(CorsConfiguration.ALL)// 设置允许的方法.allowedMethods(CorsConfiguration.ALL)// 是否允许证书(cookies).allowCredentials(true)// 跨域允许时间.maxAge(3600);//1小时内不需要校验,发送OPTIONS请求}
}

调整后:

package com.course.server.config;import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configuration
public class CorsConfig implements WebMvcConfigurer {@Overridepublic void addCorsMappings(CorsRegistry registry) {// 设置允许跨域的路由registry.addMapping("/**")// 设置允许跨域请求的域名.allowedOriginPatterns("*").allowedHeaders(CorsConfiguration.ALL)// 设置允许的方法.allowedMethods(CorsConfiguration.ALL)// 是否允许证书(cookies).allowCredentials(true)// 跨域允许时间.maxAge(3600);//1小时内不需要校验,发送OPTIONS请求}
}

When allowCredentials is true, allowedOrigins cannot contain the special value “*“ that cannot be相关推荐

  1. SpringBoot升级2.4.0所出现的问题:When allowCredentials is true, allowedOrigins cannot contain the specia

    When allowCredentials is true, allowedOrigins cannot contain the special value "*"since th ...

  2. 【SpringBoot】升级2.4.0所出现的问题:When allowCredentials is true, allowedOrigins cannot contain the specia

    项目场景: 提示:这里简述项目相关背景: 保留现场: When allowCredentials is true, allowedOrigins cannot contain the special ...

  3. SpringBoot升级所出现的问题:When allowCredentials is true, allowedOrigins cannot contain the specia

    错误信息如下 When allowCredentials is true, allowedOrigins cannot contain the special value "*" ...

  4. Springboot跨域配置报错:When allowCredentials is true, allowedOrigins cannot contain the specia

    错误信息为: When allowCredentials is true, allowedOrigins cannot contain thespecial value "*"si ...

  5. 跨域 问题:When allowCredentials is true, allowedOrigins cannot contain the specia

    解决办法:跨域配置报错,将.allowedOrigins替换成.allowedOriginPatterns即可. 修改前 @Configuration public class WebMvcConfi ...

  6. When allowCredentials is true, allowedOrigins cannot contain the specia 跨域 网关跨域

    解决办法:跨域配置报错,将.allowedOrigins替换成.allowedOriginPatterns即可. SpringBoot2.0.0中 @Configuration public clas ...

  7. Springboot 跨域配置

    访问后端接口遇到错误提示: When allowCredentials is true, allowedOrigins cannot contain the special value "* ...

  8. Spring Boot整合Shiro + Springboot +vue

    目录 02 Spring Boot整合Shiro p1.shiro概述 1 什么是Shiro 2 Shiro核心组件 p2.Shiro实现登录认证 AccountRealm.java QueryWra ...

  9. springcloud微服务中跨域配置

    跨域,指的是浏览器不能执行其他网站的脚本.它是由浏览器的同源策略造成的,是浏览器对 javascript 施加的安全限制. 同源策略,指的是协议,域名,端口都要相同,其中有一个不同都会产生跨域. 跨域 ...

最新文章

  1. 中国雪糕红黑榜,谁才是Top 1
  2. 做砸数据中台项目的9种方法
  3. 如何解决:Android中 Error generating final archive: Debug Certificate expired on 的错误
  4. 导数,微积分,牛顿运动学制作创意地图
  5. java map 不存在的key_java – HashMap表示即使它确实存在,Key也不存在
  6. Java开发环境!java基础知识点总结
  7. wex5部署教程到数据库
  8. 剑指offer-JZ82 二叉树中和为某一值的路径(一)(附区分DFS和回溯)
  9. document.cookie 获取不到_意想不到,王者荣耀中不用花钱就可以获得的皮肤有哪
  10. TCC-Transaction TCC 实现
  11. kb4023057安装失败_微软向旧版Windows 10推送易升补丁出现无法安装问题
  12. 帝国败局:一代首富,因何退隐江湖?
  13. ucwords和ucfirst用法举例!!
  14. 从300行文件系统的实现内窥Linux VFS组织
  15. 一元二次方程组的简单解法
  16. 华中科技大学组原实验记录 运算器ALU实验
  17. 计算机文档打不开是什么原因,电脑文件打不开怎么回事
  18. position属性详解
  19. 儿时的情怀除了教材的封面和王心凌的《爱你》,还有证件照上的红领巾和马尾辫
  20. win7 计算器的用法

热门文章

  1. 国际空间站20年花掉超千亿美金,一些人开始觉得它“没啥用”了
  2. 投入10个亿,每人奖300万,腾讯给科学界发奖了!
  3. 虚拟内存分页机制的页面置换
  4. Hadoop视频教程资源链接
  5. hdu1232畅通路程(并查集)
  6. web通讯录常见问题解答以及增加个性功能
  7. html中contentEditable属性
  8. 多行书写的字符串字面值
  9. 还是畅通工程(思想+代码)
  10. hdfs fsck命令查看HDFS文件对应的文件块信息(Block)和位置信息(Locations)