Hi guys,
I am trying to access the traefik dashboard. For that, I followed the docker-compose file here. Also, I added an authentication step with middleware. On the example, you use "api@internal" as router service "traefik.http.routers.dashboard.service", is it correct? Also, even changing to this configuration, I am unable to access the dashboard. What do you suggest? I visited other posts like this, but I did not find something unusual compared to my configuration file.
services:
traefik:
image: traefik:v3.2.3
hostname: '{{.Node.Hostname}}'
command:
- "--api.dashboard=true"
- "--log.level=INFO"
- "--providers.docker=true"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.swarm.exposedByDefault=false"
- "--providers.docker.network=traefik_network"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.transport.respondingTimeouts.idleTimeout=3600"
- "--entrypoints.websecure.asDefault=true"
- "--certificatesresolvers.letsencryptresolver.acme.httpchallenge=true"
- "--certificatesresolvers.letsencryptresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencryptresolver.acme.storage=/etc/traefik/letsencrypt/acme.json"
- "--certificatesresolvers.letsencryptresolver.acme.email=me@mail.com"
- "--log.format=common"
- "--log.filePath=/var/log/traefik/traefik.log"
- "--accesslog=true"
- "--accesslog.filepath=/var/log/traefik/access-log"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role==manager
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`traefik.example.com`) && (PathPrefix(`/api`))"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.tls=true"
- "traefik.http.routers.api.tls.certresolver=letsencryptresolver"
- "traefik.http.routers.dashboard.rule=Host(`traefik.example.com`) && (PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.tls.certresolver=letsencryptresolver"
- "traefik.http.routers.dashboard.service=dashboard@internal"
- "traefik.http.routers.dashboard.middlewares=myauth@docker"
- "traefik.http.middlewares.myauth.basicauth.users=test:$$apr1$$LAdrB6op$$.gz/GEIrpRzHSlrWbmjnB/"
volumes:
- "vol_certificates:/etc/traefik/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- traefik_network
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
volumes:
vol_certificates:
external: true
name: volume_certificates
networks:
traefik_network:
attachable: true
name: traefik_network