Spring Cloud Greenwichspring-cloud-netflix-zuul
进入维护模式,所以我正在尝试从 Zuul 迁移到 Spring Cloud Gateway。
使用 Zuul,我有一条类似的路线
zuul:
routes:
masterplan_match:
path: /**/masterplans/**
serviceId: api-masterplan
我在那里所做的基本上是忽略masterplan
接收路径中之前或之后的所有内容并重定向到api-masterplan
. 例如,两者/some/path/to/masterplans
都/masterplans
使用同一个 api(原因是masterplans
更大实体的子资源,它负责创建新的masterplans
,但随后masterplans
可以被视为完整的资源,用于诸如GET
细节、更新、删除等目的)。
我可以将此配置映射到 Spring Cloud Gateway 吗?查看predicates,可行的似乎是path predicate,但看起来所有匹配器都在单个路径元素上工作(除了WildcardTheRestPathElement
,但它只能用作最后一个元素 - 我认为),即:我需要写就像是
spring
cloud:
gateway:
routes:
- id: masterplan_match
uri: lb://api-masterplan # Coming from discovery client
predicates:
- Path=/some/path/to/masterplans/**, /masterplans/**
我是否遗漏了一些东西,这两条路径可以浓缩成一条吗?