Reverse-proxying traefik admin interface

Hi everyone.

I'm currently in the process of migrating from 1.7 to 2.x. on a swarm config
I had this configuration :

services:
  traefik:
    image: traefik:1.7.2-alpine
    ports:
      - "80:80"
      - "443:443"
#    labels:
#      - "traefik.enable=true"
#      - "traefik.port=8080"
    deploy:
      labels:
        - "traefik.domain=traefik.domain.tld"
        - "traefik.backend=tweb"
        - "traefik.enable=true"
        - "traefik.port=8080"
        - "traefik.frontend.rule=Host:traefik.domain.tld"
        - "traefik.frontend.entryPoints=https,http"
        - "traefik.frontend.redirect.entryPoint=https"
        - "traefik.frontend.redirect.permanent=true"
        - "traefik.docker.network=xoop_front"
        - "traefik.frontend.auth.basic=<my_user>:<my_hash>"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/var/hosting/traefik/acme.json:/etc/traefik/acme.json"
      - "/var/hosting/traefik/traefik.toml:/etc/traefik/traefik.toml"
      - "/var/hosting/traefik/log:/var/log/traefik"
    networks:
      - front

I tried to replicate this on a test stack with v2.2 and it does not work (timeout)..
Here is my config..

services:
  traefik:
    image: "traefik:v2.2"
    networks:
      - front
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--accesslog=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.rule=(Host(`host.domain.tld`) && Path(`/tr`))"
      - "traefik.http.routers.traefik.entrypoints=web"
      - "traefik.http.services.traefik.loadbalancer.server.port=8080"

Can anyone help me ?

thanks

You have both api.insecure and you are also trying to configure a router. Remove the api.insecure command line parameter.

The loadbalancer.server.port label is not required (swarm mode, yes it is).

You need to add a service of api@internal.
- "traefik.http.routers.traefik.service=api@internal"

See:
https://docs.traefik.io/operations/dashboard/#the-dashboard

ok I tried your solution, didn't work.
I went to the link you provided..
Copied/pasted the given configuration

now I have that (and it doesn't work (404))
I also tried to replace "dashboard" with the real name of the service, "traefik", it does not work either..

I thing there is a concept I don't understand well..

services:
  traefik:
    image: "traefik:v2.2"
    command:
      #- "--log.level=DEBUG"
      #- "--api.insecure=true"
      - "--api.dashboard=true"
      - "--accesslog=true"
      - "--providers.docker=true"
      - "--providers.docker.swarmMode=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
      #- "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.http.routers.dashboard.rule=Host(`db.domain.tld`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.dashboard.service=api@internal"
      - "traefik.http.routers.dashboard.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=my_user:<my_hash>"
      - "traefik.http.services.dummy-svc.loadbalancer.server.port=9999"

Sorry I missed that you tagged this swarm.

You labels need to be nested under a deploy: key in your compose when using swarm mode.