asrob
September 25, 2019, 5:21pm
1
Hello!
I use traefik v2 with docker swarm. It works well, but I would like to use traefik's dashboard. Here is my relevant config:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.traefik.rule=Host(`traefik.domain.tld`)"
- "traefik.http.routers.traefik.entrypoints=web-secure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.tls.certresolver=le-live"
- "traefik.http.routers.traefik.tls.options=default"
- "traefik.http.routers.traefik.middlewares=https-redirect@file"
- "traefik.http.routers.traefik-insecure.rule=Host(`traefik.domain.tld`)"
- "traefik.http.routers.traefik-insecure.entrypoints=web"
- "traefik.http.routers.traefik-insecure.service=api@internal"
- "traefik.http.routers.traefik-insecure.middlewares=admin-auth@file,https-redirect@file"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
- "traefik.http.services.traefik.loadbalancer.passhostheader=true"
SSL works fine, but I got "Bad gateway". What's wrong with my config, how can I fix that?
Thanks!
ldez
September 25, 2019, 5:54pm
2
hello,
could you try that:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.traefik.rule=Host(`traefik.domain.tld`)"
- "traefik.http.routers.traefik.entrypoints=web-secure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.tls.certresolver=le-live"
- "traefik.http.routers.traefik.tls.options=default"
- "traefik.http.routers.traefik.middlewares=admin-auth@file"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik-insecure.rule=Host(`traefik.domain.tld`)"
- "traefik.http.routers.traefik-insecure.entrypoints=web"
- "traefik.http.routers.traefik-insecure.middlewares=https-redirect@file"
- "traefik.http.services.traefik.loadbalancer.server.port=888" # required by swarm but not used.
1 Like
asrob
September 25, 2019, 6:11pm
3
Hi,
now it gives me error "404 page not found". Do I paste my whole configuration files and/or docker-compose.yml?
ldez
September 25, 2019, 6:32pm
4
I created a small working docker-compose file (no swarm, no Let's Encrypt) to illustrate:
version: "3.5"
services:
traefik:
image: "traefik:v2.0.0"
command:
- --log.level=DEBUG
- --api=true
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker.exposedbydefault=false
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik-redirect.rule=Host(`dash.docker.localhost`)"
- "traefik.http.routers.traefik-redirect.entrypoints=web"
- "traefik.http.routers.traefik-redirect.middlewares=https-redirect"
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.traefik.rule=Host(`dash.docker.localhost`)"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.tls=true"
# - "traefik.http.services.traefik.loadbalancer.server.port=888" # required by swarm but not used.
2 Likes
asrob
September 26, 2019, 5:20am
5
Hi ldez ,
Your first answer with code is working. I've review my configs (including .toml files) and found that dashboard = false
in traefik.toml
. I changed it to true
, used your first config and tada...
Thank you very much!