Rest Zuul路由到具有嵌套路径的服务
我正在尝试将Netflix Zuul路由配置为两个微服务(基于spring boot)Rest Zuul路由到具有嵌套路径的服务,rest,spring-cloud,netflix-zuul,Rest,Spring Cloud,Netflix Zuul,我正在尝试将Netflix Zuul路由配置为两个微服务(基于spring boot) 通过路径/foo/** 通过路径/foo/*/bar/** 我试过这样的方法,但没用: zuul: routes: foo: /foo/** bar: /foo/*/bar/** 当路径嵌套时,是否可能进行这种配置 需要这样的配置,因为/bar/子资源由bar微服务操作 foo上的上下文:/foo/ 条形图上的上下文:/foo/*/bar/**解决方案 zuul: routes:
- 通过路径
/foo/**
- 通过路径
/foo/*/bar/**
zuul:
routes:
foo: /foo/**
bar: /foo/*/bar/**
当路径嵌套时,是否可能进行这种配置
需要这样的配置,因为/bar/
子资源由bar微服务操作
foo上的上下文:/foo/
条形图上的上下文:/foo/*/bar/**
解决方案
zuul:
routes:
bar:
path: /foo/*/bar/**
serviceId: bar
stripPrefix: false
foo:
path: /foo/**
serviceId: foo
stripPrefix: false
应该是这样的,但顺序很重要,在您当前的定义中,foo优先于bar。好的,但是经过更正的顺序仍然不起作用什么是“不起作用”?可能我收到了404的
GET/foo/X/bar/Y/action
,因为microservice bar希望收到GET/foo/X/bar/Y/action
?/foo/X/bar/Y/
被传递到bar?谢谢,它可以工作!:)