Dashboard on http / local network

Hi all,

On my local network, with a respberryPi 4, I tried to enable traefik in order to access to my services on :
pi.local/homeassistant
pi.local/homebridge
etc..

pi.local is working and redirect on my rpi4.

I use docker-compose, and I already use traefik on a external server with https, so I try to adapt this to my local network.

My docker-compose.yml and traefik.toml are :

docker-compose.yml

version: "3"
services:
  traefik:
    image: traefik:latest
    # command: --api.insecure --providers.docker
    command: --providers.docker
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /dockers/traefik/traefik.toml:/traefik.toml
      - /dockers/traefik/acme.json:/acme.json
    networks:
      - webgateway
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule= Host(`pi.local`) && PathPrefix(`/traefik`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entrypoints=web"

  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    networks:
      - webgateway
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule= Host(`pi.local`) && PathPrefix(`/whoami`)"
      - "traefik.http.routers.whoami.entrypoints=web"

networks:
  webgateway:
    external: true

traefik.toml

[entryPoints]
  [entryPoints.web]
    address = ":80"

[providers]
  [providers.docker]
    watch = true
    exposedByDefault = false
    network = "webgateway"

With this configuration, whoami works and accessible on pi.local/whoami
But pi.local/traefik return a 404 error.

I tried a lot of things but can't success.

Thanks a lot to helping me,
Pierre

It's got to be /dashboard/ and /api/

...the router rule defined for Traefik must match the path prefixes /api and /dashboard

Thanks a lot @cakiwi :clap: :pray:

It works fine with teh pathprefix /api /dashboard.

I add that pi.local/dashboard didn't works, but pi.local/dashboard/#/ works, didn't know wgy

For people who want the all config files :

version: "3"
services:
  traefik:
    image: traefik:latest
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /dockers/traefik/traefik.toml:/traefik.toml
      - /dockers/traefik/acme.json:/acme.json
    networks:
      - webgateway
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule= Host(`pi.local`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.api.service=api@internal"

  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    networks:
      - webgateway
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule= Host(`pi.local`) && PathPrefix(`/whoami`)"
      - "traefik.http.routers.whoami.entrypoints=web"

networks:
  webgateway:
    external: true
[api]
  dashboard = true
  insecure = true
  debug = true

[entryPoints]
  [entryPoints.web]
    address = ":80"

[providers]
  [providers.docker]
    watch = true
    exposedByDefault = false
    network = "webgateway"

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.