Chinaunix首页 | 论坛 | 博客
  • 博客访问: 155965
  • 博文数量: 134
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1430
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(134)

文章存档

2021年(133)

2019年(1)

我的朋友

分类: Java

2021-09-01 15:33:50

 


点击(此处)折叠或打开

  1. java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain
  2. the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response
  3. header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
  4.     at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:460)
  5.     Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
  6. Error has been observed at the following site(s):
  7.     |_ checkpoint ? org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain][from fhadmin.cn]
  问题原因,新版本的gateway 取消了allowedOrigins, 对应的变更为 allowedOriginPatterns


配置修改为:

点击(此处)折叠或打开

  1. #--------gateway配置---fhadmin.cn-----
  2. #使用服务发现路由
  3. spring.cloud.gateway.discovery.locator.enabled=true
  4. #服务路由名小写
  5. spring.cloud.gateway.discovery.locator.lower-case-service-id=true
  6. #跨域配置(java fhadmin.cn)
  7. spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedOriginPatterns=*
  8. spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedHeaders=*
  9. spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedMethods=*
  10. spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowCredentials=true



阅读(108) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~