Answer the question
In order to leave comments, you need to log in
How to proxy outgoing requests from a docker container?
There is a web application in docker. I mapped port 8080:8080. The web front is available at localhost:8080/front/. When I open it through a browser, it sends different requests like
localhost:8080/service1/api
localhost:8080/service2/api
localhost:8080/service3/api
, etc.
How can I configure that requests to /service3/ are redirected to localhost:7777 (to the host machine), and the rest of the requests go to foo.bar
I tried to run through nginx, but I don’t understand how it should all work.
Thanks a lot!
----
Something tells me that I need to use this in nginx builds
location /service3/ {
proxy_pass "localhost:7777";
}
Answer the question
In order to leave comments, you need to log in
I would make all these URLs configurable, and then it would be very easy to point
localhost:7777
foobar.com
and so on when raising the container.
That is, localhost:8080 should not be hardwired
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question