提及路径时,Cloud Foundry地图路线无法正常工作 [英] Cloud Foundry map-route is not working when path mentioned
问题描述
在Cloud Foundry中,我推送了同一应用程序的两个副本,例如app1和app2。
我需要将特定请求从app1路由到app2。
注意:app1和app2是一个并且相同,但是我以不同的名称部署了两次。所以/ collections端点虽然存在于app1中,但我只想通过app2应用程序来处理。因此,我创建了以下路由。
In Cloud Foundry I have pushed two copies of the same application, Say app1 and app2. I need to route a specific request from app1 to app2. Note: app1 and app2 are one and the same, but just i have deployed twice in different name. so the /collections endpoint though it exists in app1, I would like to handle this only via app2 application.So I have created the following routes.
cf map-route app2 mydomain.com --hostname app1 --path collections
cf map-route app1 mydomain.com --hostname app1
通过上述路线,我希望 https:// app1.mydomain.com/collections 请求由app2应用程序处理。
除/ collections端点外,所有其他请求( https://app1.mydomain.com/
By the above route, I expect https://app1.mydomain.com/collections request to handled by app2 application. Except the /collections endpoint, all the other requests (https://app1.mydomain.com/*) are expected to be handled by app1.
同时发布上述路由器映射,我可以看到 https://app1.mydomain.com/collections 请求由app1提供。
Post the above mentioned router mapping also, I could see that https://app1.mydomain.com/collections request is being served by app1.
但是,当我只有以下路线时,希望所有请求都 https://app1.mydomain.com/ *由app2提供。这种情况很好。
cf map-route app2 mydomain.com --hostname app1
But when i have only the below route, expecting all the request to https://app1.mydomain.com/* is to be served by app2. this case is working fine. cf map-route app2 mydomain.com --hostname app1
所以我仅在路由 https://app1.mydomain.com/collections 到app2应用程序。
So I'm having trouble only routing my https://app1.mydomain.com/collections to a app2 application.
亲切
推荐答案
文档中未指定重叠路线的行为,因此,我认为您遇到的问题是这是因为您的两个规则重叠,并且没有办法设定最具体的规则应获胜的优先顺序。
The behaviour for overlapping routes is not specified in the documentation, so I think the problem that you're having is that your two rules overlap and there is no way to set a precedence that the most specific rule should win.
解决方案是拥有互斥的路由
The solution would be to have mutually exclusive routes.
这篇关于提及路径时,Cloud Foundry地图路线无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!