反向代理(Zuul)背后的Spring MVC

时间:2016-03-21 20:35:43

标签: spring spring-mvc spring-boot microservices netflix-zuul

我正在构建一个基于微服务架构的应用程序。我有一个使用Spring MVC的微服务,Zuul提供了反向代理。 如果没有Zuul,我的微服务就可以访问了 http://localhost/和代理http://localhost/ui/。 因此,当我点击主页面上的链接时,我必须http://localhost/ui/order但我会转到http://localhost/order,当然我会收到“未找到”。 当请求抛出Zuul时,Zuul会添加标头:X-Forwarded-HostX-Forwarded-PortX-Forwarded-Prefix(等于/ ui /)。

我正在使用Spring Boot 1.3.2 + Thymeleaf + Tomcat。

问题:如何配置spring mvc为我的链接添加前缀或者可能存在其他解决方案?

UPD:我发现了一个有趣的行为。 我将{/ order}的链接替换为{./order},当我在http://localhost时,该链接有下一个href http://localhost/order,但当我在http://localhost/时(添加/)链接有http://localhost/ui/order。这是什么?

0 个答案:

没有答案
相关问题