Zuul动态路由 [英] Zuul dynamic routing
本文介绍了Zuul动态路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将Zuul用作API网关,在一种特殊情况下,我必须根据来自客户端的数据来更改URL.我可以使用前置"过滤器执行大多数操作,但到目前为止,我无法读取路由中配置的URL.
I am trying to use Zuul as an API Gateway, in one particular scenario I have to change URL, based on data coming from client. I can do most of the things using "pre" filter but so far I'm unable to read the configured URL in the route.
这是我的路线的样子:
zuul:
#prefix: /api
sensitive-headers: Cookie,Set-Cookie,Authorization
routes:
mgmt:
path: /test/abc/mgmt/**
url: https://myserver:8080/{id}/
我要替换来自客户端的数据中的ID.截至目前,我无法读取路由中配置的"URL",在过滤器中可能是我未使用正确的API.
I want to replace id from from data received from client. As of now I am unable to read 'url' configured in the routes, in the filter may be I am not using the right API.
推荐答案
很抱歉,我可以通过自动装配来获得URL和其他路由属性
Sorry for posting looks like I can get URL and other route attributes by autowiring
RouteLocator routeLocator;
这篇关于Zuul动态路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文