SpringCloud 中 Gateway 的基本使用
依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
yaml 配置文件
spring:
cloud:
gateway:
routes:
- id: xxooroute
# 转发到的的url
uri: http://localhost:8181
predicates:
# 需要转发的path
- Path=/xx/**
# 有此参数才转发
- Query=id,.
# 为此请求方式才转发
- Method=get
filters:
# 去掉上述的一个前缀,在拼接到上述uri中
- StripPrefix=1
自定义路由
https://wwp666.blog.csdn.net/article/details/119990311