[SOLVED] Dashboard 404 after switching to usersFile for basic auth

I've got to be overlooking something very simple.Everything works perfectly if the user is added to the label directly...

- "traefik.http.middlewares.traefik-auth.basicauth.users=uname:$$ayr1$$GJr0wQ5W$$QzhuGRIckJ/zOVewa1Fei1"

However, referencing the same user and pw via file does not work...

- "traefik.http.middlewares.traefik-auth.basicauth.usersfile=/path/to/my/authfile"

The above results in a "404 page not found". I'm certain the path to the file is correct, and I've restarted all containers. Anyone have any idea what's going on?

Never mind! I'm an idiot! Of course, I had to define a volume to bind-mount the silly file in the container. (Duh) :crazy_face:

Thanks to shot for a push in the right direction. Had my own moment working this out as well. Gotta make that bind mount available to the traefik container rather than the container requiring the middleware.

version: '3'

services:

  whoami:
    image: "traefik/whoami"
    container_name: "whoami"
    labels:
      - "traefik.http.routers.whoami.rule=Host(`whoami.docker1`)"

  whoami-a:
    image: "traefik/whoami"
    container_name: "whoami-a"
    labels:
      - "traefik.http.routers.whoami-a.rule=Host(`whoami-a.docker1`)"
      # define the middleware "whoami-users"
      - "traefik.http.middlewares.whoami-users.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"
      # tell router to use a middleware named "whoami-users"
      - "traefik.http.routers.whoami-a.middlewares=whoami-users"

  whoami-b:
    image: "traefik/whoami"
    container_name: "whoami-b"
    # this doesn't work here
    #volumes:
    #  - "./usersfile.txt:/usersfile.txt:ro"
    labels:
      - "traefik.http.services.whoami-b.loadbalancer.server.port=80"
      - "traefik.http.routers.whoami-b.rule=Host(`whoami-b.docker1`)"
      # the bind mount for this file needs to be in the *traefik* container
      # define the middleware "whoami-usersfile"
      - "traefik.http.middlewares.whoami-usersfile.basicauth.usersfile=/whoami-usersfile.txt"
      # tell router to use a middleware named "whoami-usersfile"
      - "traefik.http.routers.whoami-b.middlewares=whoami-usersfile"

  traefik:
    image: traefik:v2.8.3
    command:
      - "--api.insecure=true"
      - "--providers.docker"
      - "--log.level=DEBUG"
      - "--entryPoints.http.address=:80"
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - "/home/fred/projects/whoami-b/usersfile.txt:/whoami-usersfile.txt:ro"
    labels:
      - "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.docker1`)"
      - "traefik.http.services.traefik-dashboard.loadbalancer.server.port=8080"

It would be helpful if this solution was linked or added to the BasicAuth page