如何获取Spring Cloud网关允许的CORS值

l0oc07j2  于 2022-10-23  发布在  Spring
关注(0)|答案(1)|浏览(143)

给定YAML片段

spring:
  cloud:
    gateway:
      globalcors:
        cors-configurations:
          '[/**]':
            allowedOrigins: "*"

我如何使用@Value("${spring.cloud.gateway.globalcors.cors-configurations.???.allowedOrigins")

kpbwa7wx

kpbwa7wx1#

尝尝这个

spring.cloud.gateway.globalcors.cors-configurations.'[/**]'.allowed-origins=*
spring.cloud.gateway.globalcors.cors-configurations.'[/**]'.allowed-methods=HEAD,OPTIONS,GET,POST,PUT,PATCH
spring.cloud.gateway.globalcors.cors-configurations.'[/**]'.allowed-headers=*

相关问题