# Traefik dashboard path prefix rule

**URL:** <https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345>\
**Category:** Traefik v2\
**Tags:** cli\
**Created:** [August 18, 2020, 4:49pm UTC](https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345 "2020-08-18T16:49:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fogx](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@fogx](https://community.traefik.io/u/fogx)\
**Post date:** [August 18, 2020, 4:49pm UTC](https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345/1 "2020-08-18T16:49:15Z")

</div>

Hi all,  
i've been trying to wrap my head around traefik for the past week and its been a real slog... anyway, i was looking at the dashboard router rules in the documentation, which says that the router rule must match /api and /dashboard.  
In the example, the code adds the traefik subdomain as well as the two pathPrefixes:  
` - "traefik.http.routers.dashboard.rule=Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))" `  
When i try to implement this configuration, however, my log goes crazy because the rule seems to be routing to itself, causing an endless loop. I would like to have the option of accessing my dashboard through the subdomain as well as the /dashboard prefix though. Is there something wrong with my code, or is the example not up to date anymore?

[https://docs.traefik.io/operations/dashboard/](https://docs.traefik.io/operations/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:** [August 19, 2020, 12:05pm UTC](https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345/2 "2020-08-19T12:05:37Z")

</div>

Try posting the full config. Static, Dynamic and Cli args used.

This is a rule I have applied many time myself, so the problem is likely elsewhere.

---

<div class="post-metadata">

**Author:** ![fogx](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@fogx](https://community.traefik.io/u/fogx)\
**Post date:** [August 20, 2020, 11:58am UTC](https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345/3 "2020-08-20T11:58:19Z")

</div>

hey cakiwi, thanks for your reply.  
maybe its because i'm not using the right syntax for CLI commands? here is the full compose:

```auto
version: "3.7"

services:
  traefik:
    image: "traefik:latest"
    command:
      - --entrypoints.web.address=:80
      - --providers.docker
      - --api.insecure # Don't do that in production
    labels:
      - traefik.http.routers.api.rule="Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.api.service=api@internal"

    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  my-app:
    image: containous/whoami
    labels:
      - traefik.http.routers.my-app.rule=Host(`who.example.com`)

```

---

<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:** [August 20, 2020, 12:09pm UTC](https://community.traefik.io/t/traefik-dashboard-path-prefix-rule/7345/4 "2020-08-20T12:09:31Z")

</div>

So you have `api.insecure` and you are also trying to define your own router for the dashboard.

api.insecure creates a set of rules/redirects and an entrypoint. As your router does not specify an entrypoint is will also bind to 8080 so the rules are likely in conflict for good operation of the api/dashboard.

Remove the `api.insecure` parameter and you should fare better.
