我正在构建一个基于微服务架构的应用程序 . 我有一个使用Spring MVC的微服务,Zuul提供了反向代理 . 没有Zuul,我的微服务由 http://localhost/
访问,代理由 http://localhost/ui/
访问 . 所以,当我点击主页面上的链接时,我必须去 http://localhost/ui/order
,但我去了 http://localhost/order
,当然我得到"Not found" . 当请求抛出Zuul时,Zuul添加 Headers : X-Forwarded-Host
, X-Forwarded-Port
, X-Forwarded-Prefix
(等于/ ui /) .
我正在使用Spring Boot 1.3.2 Thymeleaf Tomcat .
问题:如何配置spring mvc为我的链接添加前缀或者可能存在其他解决方案?
UPD: 我发现了一个有趣的行为 . 我将链接从{/ order}替换为,当我在 http://localhost
时,链接有一个下一个href http://localhost/order
,但是当我在 http://localhost/
(添加/)时,链接有 http://localhost/ui/order
. 这是什么?