The following example is given in the documenation:
spring:
cloud:
gateway:
routes:
- id: rewritepath_route
uri: http://example.org
predicates:
- Path=/foo/**
filters:
- RewritePath=/foo/(?<segment>.*), /$\{segment}
I have a lot of services, so instead of hard-coding foo
in the RewritePath
filter, I'd simply like to drop that part dynamically.
I came up with this but it's not working
spring:
cloud:
gateway:
default-filters:
- RewritePath=/(?<base>.*)/(?<segment>.*), /$\{segment}
routes:
- id: rewritepath_route
uri: http://example.org
predicates:
- Path=/foo/**
How does the correct reg exp syntax look like?