Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to reverse proxy app using traefik or caddy #440

Open
etorres4 opened this issue Jan 19, 2025 · 1 comment
Open

Unable to reverse proxy app using traefik or caddy #440

etorres4 opened this issue Jan 19, 2025 · 1 comment

Comments

@etorres4
Copy link

etorres4 commented Jan 19, 2025

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?

@abhijithhegde
Copy link

abhijithhegde commented Jan 20, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants