Traefik as reverse proxy server to external web server

Hello, I'm looking into Traefik as a reverse proxy server where I can inject routes via API (other options are Consul with Nginx and I think, Envoy).

I want to have a proxy.example.com proxy that terminates SSL (irrelevant for this question) and as a backend has a number of ephemeral web servers http://<ip>:<port> which are independent (not part of a LB pool) and are not part of the proxy server or related to Kubernetes or Docker. So when the user goes to [proxy.example.com/](https://proxy.example.com/)<uuid> (using a path) or [proxy.example.com](https://proxy.example.com/)?uuid=<uuid> (using query) or using header key/values, the user connects transparently with one of the servers.

I'm trying Traefik for this, not even using API but hardcoding an example, and I can't make it work. Traefik forwards traffic using PathPrefix for example and I can see the index but then all the files in the destination web server (./js/somefile.js) are 404 since it's the incorrect path.

I've tried stripping the path in the middleware like this Reverse proxy to external host - #4 by ldez and like they say, it doesn't work (using the Query in the router is the same thing).
I've also looked at How to use traefik to proxy a https request to an external server? and similar posts here but I can't find a solution.

I've been searching and I can't find the solution for this, any ideas or Traefik not the right tool? thanks!

My basic config is below, but I've tried other things:

cat docker-compose.yaml

version: '3'

services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.8
    container_name: traefik
    command:
      - "--configFile=/etc/traefik/traefik.yml"
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by api.insecure)
      - "8080:8080"
    volumes:
      - /etc/traefik/traefik.yaml:/etc/traefik/traefik.yaml
      - /var/log/traefik/:/var/log/traefik/

cat /etc/traefik/traefik.yaml

log:
  level: DEBUG  # DEBUG, INFO, WARNING, ERROR, CRITICAL
  format: common  # common, json, logfmt
  filePath: /var/log/traefik/traefik.log

accesslog:
  format: common  # common, json, logfmt
  filePath: /var/log/traefik/access.log

api:
  insecure: true

entryPoints:
  web:
    address: ":80"
  traefik:
    address: ":8080"

providers:
  file:
    filename: /etc/traefik/dynamic.yaml

cat /etc/traefik/dynamic.yaml

http:
  routers:
    my-router:
      rule: "PathPrefix(`/foo`)"
      service: my-service
  services:
    my-service:
      loadBalancer:
        servers:
          - url: "http://2.142.149.48:8080/"