# Serving Traefik's internal dashboard behind Traefik itself

**URL:** <https://community.traefik.io/t/serving-traefiks-internal-dashboard-behind-traefik-itself/3457>\
**Category:** Traefik v2\
**Tags:** rest-api, docker\
**Created:** [December 14, 2019, 3:31am UTC](https://community.traefik.io/t/serving-traefiks-internal-dashboard-behind-traefik-itself/3457 "2019-12-14T03:31:11Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [December 14, 2019, 5:48pm UTC](https://community.traefik.io/t/serving-traefiks-internal-dashboard-behind-traefik-itself/3457/7 "2019-12-14T17:48:48Z")

</div>

> [@Stolz](#):
>
> ```auto
> api:
> insecure: true
> 
> ```

As you are using `api.insecure` the dashboard and api are exposed on 8080.

By using:

> [@Stolz](#):
>
> ```auto
> - traefik.enable=true
> 
> ```

and

> [@Stolz](#):
>
> ```auto
> defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\" }}.localhost`)"
> 
> ```

you are trying to create a routing for the api/dashboard.

but I recommend to not do that because this create some extra requests and can create infinite loop.

The recommended way to do that is to use `api@internal` and `api.insecure=false`.

* * *

 ![traefik-api_dashboard-internal_provider_1](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/b3b036b57ff7eb1999fc8ef625fd44ab46bcb82b.png)

* * *

 ![traefik-api_dashboard-internal_provider](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/5/5e295687e30a2021df8e7e2aba21269b1c09dc63.png)

* * *

Example 1:

```auto
api:
  dashboard: true

providers:
  docker:
    defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\" }}.localhost`)"
    exposedByDefault: false
    network: proxy

```

```auto
version: '3'
services:
  traefik:
    container_name: traefik
    image: traefik:v2.1.1
    labels:
      traefik.enable: true
      traefik.http.routers.traefik.service: api@internal
      traefik.http.routers.traefik.entrypoints: web
    networks:
      - proxy
    ports:
      - "80:80"
    restart: always
    volumes:
      - ./config:/etc/traefik
      - /var/run/docker.sock:/var/run/docker.sock:ro

networks:
  proxy:
    external: true

```

Example 2:

```auto
version: "3.7"

services:
  traefik:
    image: traefik:v2.1.1
    container_name: traefik
    command:
      - --log.level=INFO
      - --entrypoints.web.address=:80
      - --api
      - --providers.docker.exposedbydefault=false
      - --providers.docker.network=proxy
      - '--providers.docker.defaultRule=Host(`{{ index .Labels "com.docker.compose.service" }}.localhost`)'
    ports:
      - "80:80"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      - proxy
    labels:
      traefik.enable: true
      traefik.http.routers.traefik.service: api@internal
      traefik.http.routers.traefik.entrypoints: web

networks:
  proxy:
    external: true

```

* * *

Also I recommend to not use `image: traefik:latest` but an explicit version `image: traefik:v2.1.1` (or `image: traefik:v2.1`)

---

_[View the full topic](https://community.traefik.io/t/serving-traefiks-internal-dashboard-behind-traefik-itself/3457)._
