多于单个 /path 时的 Zuul 前缀
Zuul prefix when more than a single /path
我有一个路径为 http://myhost.com/v2/1234/brand/order/issues/123
的服务需要将实际呼叫发送到 http://anotherhost.com/issues/123
。
如果我想避免写一个解决方案ZuulFilter
有没有办法,配置说:前缀是/v2/*/*/order/issues
,只用123
?
zuul:
routes:
test2:
path: /v2/*/*/orders/issues/**
url: http://anotherhost.com/issues/
stripPrefix: true
不,无法配置此类行为。您需要创建自定义 ZuulFilter
默认情况下,Zuul 只会去除不包含特殊字符的前缀。例如
zuul:
routes:
test1:
path: /orders/** <--- '/orders' is stripped
url: http://anotherhost.com/issues/
test2:
path: /*/orders/** <--- nothing is stripped
url: http://anotherhost.com/issues/
我有一个路径为 http://myhost.com/v2/1234/brand/order/issues/123
的服务需要将实际呼叫发送到 http://anotherhost.com/issues/123
。
如果我想避免写一个解决方案ZuulFilter
有没有办法,配置说:前缀是/v2/*/*/order/issues
,只用123
?
zuul:
routes:
test2:
path: /v2/*/*/orders/issues/**
url: http://anotherhost.com/issues/
stripPrefix: true
不,无法配置此类行为。您需要创建自定义 ZuulFilter
默认情况下,Zuul 只会去除不包含特殊字符的前缀。例如
zuul:
routes:
test1:
path: /orders/** <--- '/orders' is stripped
url: http://anotherhost.com/issues/
test2:
path: /*/orders/** <--- nothing is stripped
url: http://anotherhost.com/issues/