S
S
Station 722019-10-25 08:56:25
Nginx
Station 72, 2019-10-25 08:56:25

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";
}

But how to make it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2019-10-25
@vitaly_il1

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 question

Ask a Question

731 491 924 answers to any question