Hello,
I have a web project, with backend and frontend. I try to containerize each part, and use traefik so that requests are redirected to frontend ; but if there is the '/api' prefix, it goes to backend. Here's my docker-compose :
services:
fini-back:
build: ./fini
ports:
- "3000:3000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.fini-front.rule=PathPrefix(`/api`)"
fini-front:
build: ./fini-front
ports:
- "3002:3000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.fini-front.rule=Host(`localhost`)"
- "traefik.http.routers.fini-front.entrypoints=web"
traefik:
image: traefik:v2.10
container_name: "traefik"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
I also have this traefik.yml :
providers:
docker: {}
How do I achieve my goal ?