问题
最近用到了Spring Cloud Gateway,这里记录一下这个服务的常见配置。
yaml
spring:
data:
redis:
host: ${REDIS_HOST:xxx.xxx.xxx.xxx}
port: ${REDIS_PORT:2345wsd}
password: ${REDIS_PASS:sdfsdfgh}
database: ${REDIS_DB:8}
session:
redis:
flush-mode: on_save
namespace: mysystem:session
timeout: P30D
cloud:
gateway:
discovery:
locator:
# 服务名小写
lower-case-service-id: true
enabled: true
routes:
# 服务1
- id: auth-svc
uri: lb://auth-svc
predicates:
- Path=/auth/**
filters:
- StripPrefix=1
# 服务2
- id: system-svc
uri: lb://system-svc
predicates:
- Path=/system/**
filters:
- StripPrefix=1