Score:0

On a Debian 10 instance running multiple Docker containers to serve a web application, reverse proxy a URL path to another port

lr flag

This might be an easy one for experienced folks out there but I am stuck.

On a debian 10 machine, I got several containers running to serve a web application ✔

I also have a mailhog server to provide fake SMTP service. https://github.com/mailhog/MailHog/ Testing from the debian 10 machine with curl, mailhog is serving on 127.0.0.1:8025/mailhog/ as configured ✔

Outside my control and for security reasons, tech support will not open the port 8025 that Mailhog is listening to. So I can't access mailhog from outside the Debian machine ❌

So, I want to make http/s requests to http://myserver-url/mailhog be redirected to 127.0.0.1:8025/mailhog/

I tried to use a Nginx instance but the docker containers are already listening to 80, 8080 & 443 ports, as docker container ls shows below

enter image description here

Here is what I tried :

  • Nginx reverse proxying (server > location > proxy_pass) => Docker containers are the ones listening to the ports.
  • Docker proxy client https://docs.docker.com/network/proxy/ => Not finding the feature I want.

What's the advised way to proceed ?

in flag
Look at running a proxy like traefik caddy, or nginx in front of your containers.
lr flag
> nginx in front of your containers That's what I tried. I failed because docker containers are the ones listening to the ports (or getting the http request first)
in flag
You are going to have to change other container(s) to NOT use those ports, and place the proxy in front of both containers. Only the proxy should have ports published, and the proxy will use the internal docker network to communicate.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.