配置网关
前端项目的请求统一发送至gulimall-gateway,由其转发。
spring:
cloud:
gateway:
routes:
- id: admin_route
uri: lb://renren-fast
predicates:
- Path=/api/**
filters:
- RewritePath=/api/(?<segment>.*),/renren-fast/$\{segment}
## http://localhost:88/api/captcha.jpg => http://localhost:8080/renren-fast/captcha.jpg
网关会把请求负载均衡到renren-fast服务,在 注册中心 找到renren-fast的地址,并把请求路径重写为正确路径