Dashboard return 404

My traefik version:

Version:      2.1.0-rc2
Codename:     cantal
Go version:   go1.13.4
Built:        2019-11-15T19:43:27Z
OS/Arch:      linux/amd64

traefik.toml:

[global]
checkNewVersion = true
sendAnonymousUsage = false

[api]
debug = false
dashboard = true

[log]
  filePath = "/data/logs/traefik/traefik.log"
  level = "INFO"
  format = "json"
[accessLog]
  filePath = "/data/logs/traefik/access.log"

[http.routers.my-api]
  rule = "Host(`traefik.test.com`)"
  entrypoints = ["web", "web-secure"]
  service = "api@internal"
  middlewares = ["auth"]

[http.middlewares.auth.basicAuth]
  users = [
    "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
  ]

[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.web-secure]
    address = ":443"

[providers.docker]

And i run this command.

$ traefik -c traefik.toml

Why does it return 404 and where is it wrong?

$ curl http://traefik.test.com/dashboard/
404 page not found

Can anyone help, thanks very much.

Hi @zyh94946, in Traefik v2 , the static and dynamic configuration are separated, as explained in the documentation: https://docs.traefik.io/v2.0/getting-started/configuration-overview/ .

The HTTP Routers and middlewares, for instance, are object only picked in the dynamic configuration (as per their respective documentation https://docs.traefik.io/v2.0/routing/routers/ and https://docs.traefik.io/v2.0/middlewares/overview/ ).

In order to configure HTTP routers and middleware, you must enable the "file provider" (ref. https://docs.traefik.io/v2.0/providers/file/) and point it to the TOML (or yaml) file containing the configuration.

Try to change:

[providers.docker]

by

[providers]
  [providers.docker]
  [providers.file]
    filename = "traefik.toml"

Thanks for your reply, this is my mistake, I go and look the documentation. :slight_smile:

Hi @zyh94946 do not worry, it was not a mistake. I put the documentation links only to help you to learn on this complicate topic :slight_smile: Have fun with Traefik!

Thank you for solving my question :smile:

Hey @dduportal, does this advice apply to dynamic configuration with Docker labels? More generally - are dynamic config files and Docker labels the same thing?

Traefik gets its dynamic configuration from providers: whether an orchestrator, a service registry, or a plain old configuration file.

The dynamic configuration sources can be:

  • a file
  • the labels from Docker
  • an Ingress file
  • anf IngressRoute file
  • ...