In respect of spring cloud starter zuul we could route request path by following configuration:
application.yml
server:
port: 80
zuul:
routes:
amqp:
url: http://127.0.0.1:8010/amqp
astm:
url: http://127.0.0.1:8011/astm
mllp:
url: http://127.0.0.1:8012/mllp
labs:
url: http://127.0.0.1:8013/labs
Using this configuration request from http://127.0.0.1/mllp routed to http://127.0.0.1:8012/mllp. But I would like to use it for port-forwarding, Is it possible? lets say for :
============================================
request forwarded
tcp ip:port tcp ip:port
============================================
0.0.0.0:22210 192.168.0.10:22210
0.0.0.0:55510 192.168.0.11:55510
============================================
If possible how to configure it? Or any easy mechanism in spring boot application for port-forwarding?
You mean as some kind of HAProxy replacement which runs service agnostic? Then the answer is: no! As you can see from the Zuul Wiki its only purpose is to filter and route HttpRequests and HttpResponses. You'll also find out the same by checking the code of ZuulServlet
which just handles HttpServletRequest
s and HttpServletResponse
s.