我正在兩個使用docker的容器中運行兩個微服務,分別爲demo1和demo2。我已經在demo1中配置了zuul。我想從demo1路由到demo2,也就是說,我想從demo1訪問demo2中的api。在docker中使用zuul路由到其他容器
demo1在端口8080上運行,demo2在端口8030上運行,我想像這樣訪問api - 「localhost:8030/zuultest/test」。但路由不起作用。如果我像訪問「localhost:8080/test」那樣訪問demo1,它工作正常。
這是我在application.yml-
server:
port: 8030
#TODO: figure out why I need this here and in bootstrap.yml
spring:
application:
name: zuul server
endpoints:
restart:
enabled: true
shutdown:
enabled: true
health:
sensitive: false
zuul:
routes:
zuultest:
url: http://localhost:8080
stripPrefix: false
ribbon:
eureka:
enabled: false