Spring Cloud Greenwich puts spring-cloud-netflix-zuul
in maintenance mode, so I am trying to migrate from Zuul to Spring Cloud Gateway.
With Zuul I have a route like
zuul:
routes:
masterplan_match:
path: /**/masterplans/**
serviceId: api-masterplan
What I am doing there is basically ignoring everything that comes before or after masterplan
in the received path and redirect to api-masterplan
. For example, both /some/path/to/masterplans
and /masterplans
goes to the same api (the reason being masterplans
are a subresource of a bigger entity, which is responsible for creating new masterplans
, but then masterplans
can be treated as full blown resources for purposes like GET
ting details, updating, deleting).
Can I map this configuration to Spring Cloud Gateway? Looking at predicates, the feasible one seems to be path predicate, but then it looks like all matchers work on individual path elements (except the WildcardTheRestPathElement
, which however can be used only as last element - I think), ie: I would need to write something like
spring
cloud:
gateway:
routes:
- id: masterplan_match
uri: lb://api-masterplan # Coming from discovery client
predicates:
- Path=/some/path/to/masterplans/**, /masterplans/**
Am I missing something and can the two paths be condensed in one?
- Path=/some/path/to/masterplans/**, /masterplans/**
– Avulsion