peppermint icon indicating copy to clipboard operation
peppermint copied to clipboard

Unable to reverse proxy app using traefik or caddy

Open etorres4 opened this issue 1 year ago • 2 comments

Hi, as the title suggests I can't reverse proxy to the app, which is how I handle TLS certificates.

I expose the app to traefik by connecting it on the proxy network, which traefik watches for to automatically route traffic. Additionally, the container is on the peppermint_default network automatically generated by docker-compose, which is how it connects to the database.

I notice that the app is only listening to traffic on the interface for peppermint_default, as you can see in this image:

Image

Judging from the output of running docker container inspect peppermint (irrelevant lines truncated), we can see that it is listening only to the interface on peppermint_default network, not proxy:

"Networks": {
  "peppermint_default": {
    "Gateway": "172.19.0.1",
    "IPAddress": "172.19.0.3",
  },
  "proxy": {
    "Gateway": "172.18.0.1",
    "IPAddress": "172.18.0.5",
  }
}

For the time being, I can work around by directly exposing the port to localhost using docker-compose and then setting up traefik to route to that port, but I feel it would be a cleaner solution to have the service listen on 0.0.0.0 to avoid this happening in the first place.

I was wondering if it was possible to change this behavior?

etorres4 avatar Jan 19 '25 23:01 etorres4

I faced a similar issue and resolved it by using an additional NGINX reverse proxy inside the docker-compose.yml file. Below is the configuration I used:

nginx:
   container_name: peppermint_nginx
    image: 'nginx:latest'
    restart: always
    ports:
      - '3001:3001'
    volumes:
      - '/home/ec2-user/nginx/nginx.conf:/etc/nginx/nginx.conf:ro'
    depends_on:
      - peppermint

abhijithhegde avatar Jan 20 '25 09:01 abhijithhegde

Agreed with @etorres4
Maybe this can be resolve by passing a environment variable that indicate the base URL of the API

titouan-joseph avatar Sep 29 '25 19:09 titouan-joseph