Dashboard and API only work when api.insecure is true

My config is below. It only works when the insecure line is uncommented.

http://10.195.133.68:8000 returns a 404. When I uncomment the insecure = true line, I am able to access the dashboard.

[global]
  checkNewVersion = true
  sendAnonymousUsage = true

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

  [entryPoints.https]
    address = ":443"

  [entryPoints.traefik]
    address = ":8000"

[http.routers.my-api]
    entryPoints = ["traefik"]
    rule="Host(`10.195.133.68`)"
    service="api@internal"
    middlewares=["auth"]

[http.middlewares.auth.basicAuth]
    users = [
        "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", 
      ]

[api]
  # insecure = true
  dashboard = true
[ping]
[providers.docker]
## traefik.toml
## Static configuration
[entryPoints]
  [entryPoints.web]
    address = ":80"

  [entryPoints.https]
    address = ":443"

  [entryPoints.traefik]
    address = ":8000"

[api]
  
[ping]

[providers.docker]

[providers.file]
  filename = "dynamic_conf.toml"
## dynamic_conf.toml
## Dynamic configuration

[http.routers.my-api]
    entryPoints = ["traefik"]
    rule = "PathPrefix(`/dashboard`) || PathPrefix(`/api`)"
    service = "api@internal"
    middlewares = ["auth"]

[http.middlewares.auth.basicAuth]
  users = [
    test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", 
  ]
2 Likes

Separating the dynamic configuration into a separate dynamic file fixed this for me. Thanks for your help.

Following the docker-compose example in getting started:

Static config:
traefik.toml

[api]
[entryPoints.traefik]
  address = ":8080"

docker-compose.yml

  reverse-proxy:
    image: traefik:v2.2
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI
      - "8080:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
      # Make config present in the container
      - ./traefik.toml:/etc/traefik/traefik.toml
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      - "traefik.http.routers.traefik.entrypoints=traefik"
      - "traefik.http.routers.traefik.service=api@internal"