zoukankan      html  css  js  c++  java
  • gateway 报错 allowedOrigins cannot contain the special value "*"

     
    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.
    	at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:460)
    
    	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
    Error has been observed at the following site(s):
    	|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain][from www.fhadmin.org]

    问题原因,新版本的gateway 取消了allowedOrigins, 对应的变更为 allowedOriginPatterns

    配置修改为:

    #--------gateway配置--------
    #使用服务发现路由
    spring.cloud.gateway.discovery.locator.enabled=true
    #服务路由名小写
    spring.cloud.gateway.discovery.locator.lower-case-service-id=true
    #跨域配置(java www.fhadmin.org)
    spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedOriginPatterns=*
    spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedHeaders=*
    spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowedMethods=*
    spring.cloud.gateway.globalcors.corsConfigurations.[/**].allowCredentials=true

     一:springcloud服务 -----------------------

    java www.fhadmin.org

    ------------------------------------------
    1.nacos 阿里注册中心:官方eureka停止更新,目前比较好的取代者就是nacos
    2.zipkin 跟踪服务:分布式跟踪日志,基于内存存储记录
    3.gateway 网关路由服务:分发请求,统一管理过滤,结合 ribbon 负载均衡、feign服务调用
    4.springboot-admin 监控中心服务:统一界面管理,查看各个服务运行状态 actuator健康检查
    5.sentinel 高可用流量管理框架:以流量为切入点,限流、流量整形、熔断降级、系统负载保护、热点防护

  • 相关阅读:
    怎样使用Chrome模拟手机浏览器測试移动端网站
    [Erlang危机](5.1.3)进程
    Oracle ErrorStack 使用和阅读具体解释
    动态规划之整齐打印
    struts2+Oracle实现管理员查看用户提交的意见功能
    hdu 4956 Poor Hanamichi BestCoder Round #5(数学题)
    2014牡丹江——Known Notation
    诗云:静观天下
    QQ欢乐斗地主心得体会 (三):高倍场攻略
    QQ欢乐斗地主心得体会 (三):高倍场攻略
  • 原文地址:https://www.cnblogs.com/sjingser1/p/14862209.html
Copyright © 2011-2022 走看看