Dashboard gives me an error (Bad gateway)

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!

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

Hi,

now it gives me error "404 page not found". Do I paste my whole configuration files and/or docker-compose.yml?

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

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... :slight_smile:

Thank you very much!