Hi all,
I am trying to configure docker-compose using Traefik to redirect requests to two webservers.
Rule for redirect should be based on the url path. By default (localhost) the traffic should be redirected to container UI and when the path is localhost/angular tha traffix should be redirected to container with angular app.
Issue description: I can target the localhost and the UI container will respond but when i hit localhost/angular I can see that still the UI container is being target and I am getting then 404 because the page does not exist on that container.
Here is my docker-compose:
version: "3"
services:
traefik:
image: traefik:v2.11
command: --api.insecure=true --providers.docker
ports:
- 80:80
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
angular:
build:
context: ./ui/angular
ports:
- 81:8080
labels:
- traefik.enable=true
- traefik.http.routers.angular.rule=(Host(`localhost`) && PathPrefix(`/angular`))
- traefik.http.routers.angular.priority=1
ui:
build:
context: .
dockerfile: ./ui/web/dockerfile
depends_on:
- angular
volumes:
- ./ui/web/html/:/var/www/html
labels:
- traefik.enable=true
- traefik.http.routers.ui.rule=Host(`localhost`)
- traefik.http.routers.ui.priority=5
ports:
- 82:80
- 443:443