Traefik in docker-compose redirect config for two webservers

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

There is no magic in Traefik. When you send a request ยดhttp://domain.tld/path` to Traefik, then it will forward the same request to your target service/container with the same (domain and) path, so your application needs to respond to that.

You can remove the path from the forwarded request with middlewares, but this mostly just works for APIs. Web apps will usually respond with links, redirects, images and scripts with absolute path names, so this breaks. Therefore its best practice to use sub-domains for apps, or they they need to support some kind of "base path" setting internally.

PS: It's probably not "redirect", as a redirect tells the browser to visit a different address. A proxy will "proxy" or "forward" requests.