# Enable auth based traefik dashboard

**URL:** <https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025>\
**Category:** Traefik v2\
**Tags:** dashboard-api, file\
**Created:** [June 28, 2021, 12:37pm UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025 "2021-06-28T12:37:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![avaj](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@avaj](https://community.traefik.io/u/avaj)\
**Post date:** [June 28, 2021, 12:37pm UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/1 "2021-06-28T12:37:51Z")

</div>

I am pretty new playing around traefik. I want to enable auth based traefik dashboard but I am no where close to it.

traefik.toml

```auto
[api]
  dashboard = true

[entryPoints]
  [entryPoints.dashboard]
    address = ":8443"

[http.routers.api]
  rule = "PathPrefix(`/dashboard`))"
  entryPoints = ["dashboard"]
  service = "api@internal"
  middlewares = ["auth"]

[http.middlewares.auth.basicauth]
  users = [
    "user:passwd",
  ]

```

I tried things around entrypoints and routers but couldn't get it working, page simply returns 404.

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [June 28, 2021, 2:43pm UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/2 "2021-06-28T14:43:50Z")

</div>

You are mixing you dynamic and static configuration in the same file. You will need to split them up.

[https://doc.traefik.io/traefik/getting-started/configuration-overview/](https://doc.traefik.io/traefik/getting-started/configuration-overview/)

---

<div class="post-metadata">

**Author:** ![avaj](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@avaj](https://community.traefik.io/u/avaj)\
**Post date:** [June 29, 2021, 7:16am UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/3 "2021-06-29T07:16:06Z")

</div>

I moved out my router config to dynamic configuration file but I still get 404

traefik.toml

```auto
[api]
  dashboard = true

[entryPoints]
  [entryPoints.dashboard]
    address = ":8443"

[providers.file]
  filename = "/etc/traefik-dy.toml"

```

traefik-dy.toml

```auto
[http]
  [http.routers.api]
    rule = "(PathPrefix(`/dashboard`))"
    entryPoints = ["dashboard"]
    service = "api@internal"
    middlewares = ["auth"]

  [http.middlewares]
    [http.middlewares.auth.basicauth]
      users = [
        "user:passwd",
      ]

```

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [June 29, 2021, 10:53am UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/4 "2021-06-29T10:53:53Z")

</div>

What url are you using? The dashboard url has to end in / to load correclty.

i.e. `http://example.com/dashboard/`

---

<div class="post-metadata">

**Author:** ![avaj](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@avaj](https://community.traefik.io/u/avaj)\
**Post date:** [June 29, 2021, 11:13am UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/5 "2021-06-29T11:13:51Z")

</div>

yes I am ending the URL correctly with /

[http://domain:8443/dashboard/](http://domain:8443/dashboard/)

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [June 29, 2021, 11:53am UTC](https://community.traefik.io/t/enable-auth-based-traefik-dashboard/11025/6 "2021-06-29T11:53:37Z")

</div>

You're missing rules for the /api endpoint too, they are both required for the dashboard.

[https://doc.traefik.io/traefik/operations/dashboard/#dashboard-router-rule](https://doc.traefik.io/traefik/operations/dashboard/#dashboard-router-rule)
