Redirect to dashboard

Hello,
Help me make the dashboard accessible

  1. on a different port than the default 8080
  2. on https://172.28.194.111/dashboard
    This is my compose(shortened):
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

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

    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.

None cheating solution using the 'secure' dashboard.

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.

Disable insecure (doc), see simple Traefik example

.

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?

As per official documentation v.10

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

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.