我们玩的是docker和spring boot,这对我们来说还是个新手..
下面是我们的用例:
* There are three Spring Boot based web applications
- web1 = works on port 8010 = exposes API as http://...:8010/web1/rest/someEndPoint_1
- web2 = works on port 8020 = exposes API as http://...:8020/web2/rest/someEndPoint_2
- web3 = works on port 8030 = exposes API as http://...:8030/web3/rest/someEndPoint_3
* All of these should be packaged in single docker image
* Docker may have apache/haproxy/nginx and it should expose port 8080, which 将映射到8080处的主机端口
* Here is requirement :
- If request will come to Docker as http://DOCKER_HOST_IP:8080/web1/rest/someEndPoint_1
==> host will forward traffic to container
==> Proxy running inside container will see pattern
==> http://...:8010/web1/rest/someEndPoint_1
- If request will come to Docker as http://DOCKER_HOST_IP:8080/web2/rest/someEndPoint_1
==> host will forward traffic to container
==> Proxy running inside container will see pattern
==> http://...:8020/web2/rest/someEndPoint_1
- If request will come to Docker as http://DOCKER_HOST_IP:8080/web3/rest/someEndPoint_1
==> host will forward traffic to container
==> Proxy running inside container will see pattern
==> http://...:8030/web3/rest/someEndPoint_1有可能实现吗?(基本上,我们被要求检查是否可以基于URL模式路由流量?)
请随时添加评论/编辑问题!谢谢你,谢谢你。致敬..
发布于 2018-09-27 16:53:09
您正在寻找API网关,它将把传入的请求路由到一点,以提供不同的服务。您应该查看一下Spring Cloud Gateway,看看它是否能满足您的需求。
配置应该非常简单,您将在端口8080上公开您的网关,并配置到所有服务的正确路由。
之后,您将能够将所有apis聚合到一个ip:port下
更多信息可以在cloud gateway tutorial上找到。
https://stackoverflow.com/questions/52532763
复制相似问题