官网文档:https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/
网关配置文件样例
spring:
cloud:
gateway:
routes:
- id: acl_service_other
uri: http://124.222.140.203:9080
#uri: http://whmake.site:8080
predicates:
- Path=/api/**
filters:
##由于微服务中设置了server.servlet.context-path=/flab,要重写路径才能正常路由到该微服务
- RewritePath=/(?<segment>.*), /flab/$\{segment}
- id: baby_service
uri: http://website.com:9080
predicates:
- Path=/baby/**