网上的写法,都有点不太一样。
首先,看一下我的gateway版本
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> <version>3.0.3</version> </dependency>
配置文件:
spring: cloud: gateway: globalcors: cors-configurations: ‘[/**]‘: allowed-headers: "*" allowed-origins: "*" allowed-methods: "*"