feat(gateway): 配置跨域
This commit is contained in:
parent
0acd71150e
commit
22bcf26694
|
@ -6,10 +6,12 @@ import org.springframework.cloud.gateway.filter.GlobalFilter;
|
|||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RouterGlobalFilter implements GlobalFilter, Ordered {
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
globalCors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowed-origin-patterns:
|
||||
- "*"
|
||||
allowed-headers:
|
||||
- "*"
|
||||
allowed-methods:
|
||||
- "*"
|
||||
routes:
|
||||
- id: service-baidu
|
||||
uri: https://www.baidu.com
|
||||
|
|
Loading…
Reference in New Issue