Problem with configuration - dashbobard only display

i want only test dashboard, but traefik return 404 error:

this is my traefik,yml file:

log:

  level: WARN


api:
  dashboard: true

entryPoints:
  http:
    address: ":8081"

# Dynamic configuration
http:
  routers:
    api-router:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      service: api@internal
      entryPoints:
        - http
        
  middlewares:
    user-auth:
      basicAuth:
        users:
          - "user:$apr1$tr4xmavg$BVDfOg1qtWtd8L34VPBih/" #user/user

and i run it with this command:
traefik --configfile=traefik.yml

and:

$ http http://127.0.0.1:8081/dashboard
HTTP/1.1 404 Not Found
Content-Length: 19
Content-Type: text/plain; charset=utf-8
Date: Mon, 20 Jan 2025 23:22:58 GMT
X-Content-Type-Options: nosniff

404 page not found


$ http http://127.0.0.1:8081/api
HTTP/1.1 404 Not Found
Content-Length: 19
Content-Type: text/plain; charset=utf-8
Date: Mon, 20 Jan 2025 23:23:33 GMT
X-Content-Type-Options: nosniff

404 page not found

http as root element is Traefik dynamic config, it needs to be loaded by a provider in Traefik static config, like with providers.file from a separate dynamic config file (doc).

Maybe check simple Traefik example.