# Redirect to dashboard

**URL:** <https://community.traefik.io/t/redirect-to-dashboard/18787>\
**Category:** Traefik v2\
**Tags:** dashboard-api, docker-swarm, docker\
**Created:** [June 1, 2023, 12:45pm UTC](https://community.traefik.io/t/redirect-to-dashboard/18787 "2023-06-01T12:45:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nexovec](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nexovec/32/7163_2.png) [@nexovec](https://community.traefik.io/u/nexovec)\
**Post date:** [June 1, 2023, 12:45pm UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/1 "2023-06-01T12:45:26Z")

</div>

Hello,  
Help me make the dashboard accessible

1. on a different port than the default 8080
2. on [https://172.28.194.111/dashboard](https://172.28.194.111/dashboard)  
This is my compose(shortened):

```auto
version: "3.3"
services:
  traefik:
    image: "traefik:v2.10.1"
    command:
      - "--log.level=ERROR"
      - "--providers.docker=true"
      - "--api=true"
      - "--api.debug=true"
      - "--api.insecure=true"
      - "--api.dashboard=true"
      - "--providers.docker.exposedbydefault=false"

      # entrypoints
      - "--entrypoints.websecure"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.web"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.dashboard"
      - "--entrypoints.dashboard.address=:2234"

      # # redirect http to https
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entryPoint.scheme=https"

      # certificate resolver
      - "--certificatesResolvers.staging"
      - "--certificatesResolvers.staging.acme.email=hraccesky@gmail.com"
      - "--certificatesResolvers.staging.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesResolvers.staging.acme.httpChallenge.entryPoint=websecure"
    labels:
      - traefik.http.routers.dashboard.entrypoints=websecure
      - traefik.http.routers.dashboard.rule=Host(`172.28.194.111`)
      - traefik.http.routers.dashboard.service=dashboard@internal
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"

```

It contains one of my many attempts on changing the port on the dashboard in the labels.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![MartenM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/martenm/32/7179_2.png) [@MartenM](https://community.traefik.io/u/MartenM)\
**Post date:** [June 1, 2023, 1:48pm UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/2 "2023-06-01T13:48:56Z")

</div>

I use the following labels to make the dashboard accessible on a subdomain using HTTPS

```auto
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik_https.rule=PathPrefix(`/dashboard`)"
      - "traefik.http.routers.traefik_https.entrypoints=websecure"
      - "traefik.http.routers.traefik_https.tls=true"
      - "traefik.http.services.traefik_https.loadbalancer.server.port=8080"

```

Change the entrypoint to the port you want as entry. Change the rule to how you want to setup routing.

This is cheating a tiny bit, because we essentially route it to the other entrypoint setup for the dashboard by traefik, but it works fine.

---

<div class="post-metadata">

**Author:** ![MartenM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/martenm/32/7179_2.png) [@MartenM](https://community.traefik.io/u/MartenM)\
**Post date:** [June 1, 2023, 2:00pm UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/3 "2023-06-01T14:00:04Z")

</div>

None cheating solution using the 'secure' dashboard.

```auto
labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik_https.rule=Host(`traefik.<company_name>`)"
      - "traefik.http.routers.traefik_https.entrypoints=websecure"
      - "traefik.http.routers.traefik_https.tls=true"
      - "traefik.http.routers.traefik_https.service=api@internal"

```

I think that part of your problem is also the 'hostname' thing. Try using 'traefik.localhost' to test.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 1, 2023, 6:42pm UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/4 "2023-06-01T18:42:38Z")

</div>

Disable `insecure` ([doc](https://doc.traefik.io/traefik/operations/dashboard/#insecure-mode)), see [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt)

.

---

<div class="post-metadata">

**Author:** ![nexovec](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nexovec/32/7163_2.png) [@nexovec](https://community.traefik.io/u/nexovec)\
**Post date:** [June 2, 2023, 10:34am UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/5 "2023-06-02T10:34:26Z")

</div>

I did the changes you've suggested, I still can't get into the dashboard.

Why are you using `api@internal` instead of `dashboard@internal`?

In addition, `curl localhost` says `Moved Permanently` and `curl traefik.localhost` says `Could not resolve host: traefik.localhost`.

I'm using WSL, could that be the problem?

---

<div class="post-metadata">

**Author:** ![MartenM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/martenm/32/7179_2.png) [@MartenM](https://community.traefik.io/u/MartenM)\
**Post date:** [June 2, 2023, 10:57am UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/6 "2023-06-02T10:57:25Z")

</div>

> [@nexovec](#):
>
> Why are you using `api@internal` instead of `dashboard@internal`?

[As per official documentation v.10](https://doc.traefik.io/traefik/operations/dashboard/#secure-mode)

> [@nexovec](#):
>
> I'm using WSL, could that be the problem?

That mostly depends on where you have the docker engine running, and where you execute the CURL command.

---

<div class="post-metadata">

**Author:** ![nexovec](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nexovec/32/7163_2.png) [@nexovec](https://community.traefik.io/u/nexovec)\
**Post date:** [June 2, 2023, 11:57am UTC](https://community.traefik.io/t/redirect-to-dashboard/18787/7 "2023-06-02T11:57:35Z")

</div>

I am running Ubuntu 22.04.2 LTS on Windows 10 x86\_64 in WSL2, with systemd enabled. Docker engine runs inside this WSL too. Suspiciously, the curl command was also executed on the WSL, and the behavior is very odd.  
I did turn off ubuntu's `DNSStubListener`, because I'm also trying to configure bind9 on the side, which required me to do this.
