# Not loading all of my static configuration

**URL:** <https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154>\
**Category:** Traefik v3 (latest)\
**Tags:** file, docker\
**Created:** [January 20, 2025, 6:54pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154 "2025-01-20T18:54:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![synfinatic](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@synfinatic](https://community.traefik.io/u/synfinatic)\
**Post date:** [January 20, 2025, 6:54pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/1 "2025-01-20T18:54:55Z")

</div>

I'm just getting started with Traefik so keeping it simple.

docker-compose.yaml:

```yaml
version: '3'

services:
  reverse-proxy:
    # The official v3 Traefik docker image
    image: traefik:v3.3
    # Enables the web UI and tells Traefik to listen to docker
    ports:
      # The HTTP port
      - "8000:80"
      # The Web UI (enabled by --api.insecure=true)
      # - "8080:8080"
      # https port
      - "8443:443"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./acme.json:/letsencrypt/acme.json:rw
      - ./traefik.yaml:/etc/traefik/traefik.yaml
      - ./htpasswd:/etc/traefik/htpasswd

  whoami:
    # A container that exposes an API to show its IP address
    image: traefik/whoami
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.entrypoints=web"
      - "traefik.http.routers.whoami.rule=PathPrefix(`/whoami/`)"
# - "traefik.http.middlewares.basic-auth.basicAuth.usersFile=/etc/traefik/htpasswd"
      - "traefik.http.routers.whoami.middlewares=basic-auth@file"

```

traefik.yaml:

```yaml
api:
  dashboard: false

log:
  level: DEBUG

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedbydefault: false

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"

# generate user w/ password: echo $(htpasswd -nB user)

http:
  middlewares:
    basic-auth:
      basicAuth:
        usersFile: "/etc/traefik/htpasswd"

```

When I start up, I see that only the first part of my static config is loaded (nothing from the http.middlewares section) (ran through jq for easier reading):

```auto
Static configuration loaded [json] staticConfiguration=
{
  "api": {
    "basePath": "/"
  },
  "entryPoints": {
    "web": {
      "address": ":80",
      "forwardedHeaders": {},
      "http": {
        "maxHeaderBytes": 1048576
      },
      "http2": {
        "maxConcurrentStreams": 250
      },
      "observability": {
        "accessLogs": true,
        "metrics": true,
        "tracing": true
      },
      "transport": {
        "lifeCycle": {
          "graceTimeOut": "10s"
        },
        "respondingTimeouts": {
          "idleTimeout": "3m0s",
          "readTimeout": "1m0s"
        }
      },
      "udp": {
        "timeout": "3s"
      }
    },
    "websecure": {
      "address": ":443",
      "forwardedHeaders": {},
      "http": {
        "maxHeaderBytes": 1048576
      },
      "http2": {
        "maxConcurrentStreams": 250
      },
      "observability": {
        "accessLogs": true,
        "metrics": true,
        "tracing": true
      },
      "transport": {
        "lifeCycle": {
          "graceTimeOut": "10s"
        },
        "respondingTimeouts": {
          "idleTimeout": "3m0s",
          "readTimeout": "1m0s"
        }
      },
      "udp": {
        "timeout": "3s"
      }
    }
  },
  "global": {
    "checkNewVersion": true
  },
  "log": {
    "format": "common",
    "level": "DEBUG"
  },
  "providers": {
    "docker": {
      "defaultRule": "Host({{ normalize .Name }})",
      "endpoint": "unix:///var/run/docker.sock",
      "watch": true
    },
    "providersThrottleDuration": "2s"
  },
  "serversTransport": {
    "maxIdleConnsPerHost": 200
  },
  "tcpServersTransport": {
    "dialKeepAlive": "15s",
    "dialTimeout": "30s"
  }
}
reverse-proxy_1 | 2025-01-20T18:44:06Z INF github.com/traefik/traefik/v3/cmd/traefik/traefik.go:633 >

```

Which then results in the following expected error:

```auto
reverse-proxy_1 | 2025-01-20T18:44:06Z ERR github.com/traefik/traefik/v3/pkg/server/router/router.go:136 > error="middleware \"basic-auth@file\" does not exist" entryPointName=web routerName=whoami@docker

```

I've tried a number of things and nothing I seem to put in the `http` block ends up being loaded by the final config. I've also tried configuring the dashboard on the two endpoints and that doesn't work either.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [January 22, 2025, 6:51am UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/2 "2025-01-22T06:51:47Z")

</div>

`http` is Traefik dynamic config. Place it in a separate config file and load it in static config via `providers.file`([doc](https://doc.traefik.io/traefik/getting-started/configuration-overview/)).

Or add it as labels, read by `providers.docker`, see [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt).

---

<div class="post-metadata">

**Author:** ![synfinatic](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@synfinatic](https://community.traefik.io/u/synfinatic)\
**Post date:** [January 22, 2025, 2:59pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/3 "2025-01-22T14:59:40Z")

</div>

Yeah, I know how to do the docker labels thing... but that doesn't work well for everything (`api@internal` being the obvious one) and it's not very DRY for global config like my example.

Thanks for explaining the dynamic config thing has to go into it's own file... that was so very not obvious in the docs.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [January 22, 2025, 3:15pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/4 "2025-01-22T15:15:49Z")

</div>

Not sure if I understand correctly, labels work very well with `api@internal` ([example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt)).

And in the next (minor?) Traefik release we hopefully get `.loadbalancer.server.url=` in labels ([related post](https://community.traefik.io/t/redirect-to-external-url-field-not-found-servers/25953/6)).

---

<div class="post-metadata">

**Author:** ![synfinatic](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@synfinatic](https://community.traefik.io/u/synfinatic)\
**Post date:** [January 22, 2025, 10:31pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/5 "2025-01-22T22:31:05Z")

</div>

i dunno man, i tried assigning the label to the traefik container and it never worked and gave up. ended up having to add it to another container which worked. Figured it was some chicken/egg thing.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [January 25, 2025, 10:31pm UTC](https://community.traefik.io/t/not-loading-all-of-my-static-configuration/26154/6 "2025-01-25T22:31:43Z")

</div>

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