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.cn]

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

    配置修改为:

    #--------gateway配置---fhadmin.cn-----
    #使用服务发现路由
    spring.cloud.gateway.discovery.locator.enabled=true
    #服务路由名小写
    spring.cloud.gateway.discovery.locator.lower-case-service-id=true
    #跨域配置(java www.fhadmin.cn)
    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

     -------------------------www.fhadmin.cn-----------------------------------------自定义表单
    28. 定义模版:拖拽左侧表单元素到右侧区域,编辑表单元素,保存表单模版
    29. 表单模版:编辑维护表单模版,复制表单模版,修改模版类型,预览表单模版
    30. 我的表单:选择表单模版,编辑表单规则,是否上传图片、附件、开启富文本、挂靠流程开关等
    31. 表单数据:从我的表单进去可增删改查表单数据,修改表单规则
    32. 挂靠记录:记录表单数据和流程实例ID关联记录,可删除

  • 相关阅读:
    docker安装nginx
    docker安装tomcat&部署javaweb程序
    linux/work
    Go语言入门篇-gRPC基于golang & java简单实现
    Go语言入门篇-jwt(json web token)权限验证
    Go语言入门篇-JSON&http调用
    Go语言入门篇-基本流程控制
    Go语言入门篇-基本类型排序和 slice 排序
    Go语言入门篇-高级数据类型
    Go语言入门篇-基本数据类型
  • 原文地址:https://www.cnblogs.com/teacher11/p/15214890.html
Copyright © 2011-2022 走看看