Auth@file does not exist with forwardAuth. why?

I've been stuck with this problem. I dont use docker, instead .toml files with a service. The error shows
level=error msg="middleware \"proxy-auth-Name@file\" does not exist" entryPointName=https routerName=subpage@file
I really don't know what it could be. I checked typos, I recheked it many times, am I missing something?

My dynamic file, dynamic.toml, reads

[http.routers]
  [http.routers.subpage]
    entryPoints = ["https"]
    rule = "Host(`myhostname.website.com`) && PathPrefix(`/subpage`)"
    middlewares = ["proxy-auth-Name"]
    service = "subpage"
    [http.routers.subpage.tls]

[http.services]
  [[http.services.subpage.loadBalancer.servers]]
    url = "http://172.18.25.161:6805"

Then I have 2 files, that I will call static files...these are static.toml and traefik.toml.

static.toml reads

[[tls.certificates]]
  certFile = "/opt/traefik/SSL/mycert.pem"
  keyFile = "/opt/traefik/SSL/mycert.key"

[http.routers]
  [http.routers.http_catchall]
    entryPoints = ["http"]
    middlewares = ["https_redirect"]
    rule = "HostRegexp(`{any:.+}`)"
    service = "name"

  [http.routers.name]
    entryPoints = ["https"]
    entryPoints = ["http"]
    rule = "Host(`myhostname.website.com`)"
    middlewares = ["sts"]
    service = "name"
    [http.routers.name.tls]

[http.services]
  [[http.services.name.loadBalancer.servers]]
    url = "http://172.18.25.159:8888" 
   # ip of hostname 

[http.middlewares]
  [http.middlewares.sts.headers]
    stsSeconds = 63072000
    stsIncludeSubdomains = true
    stsPreload = true

  [http.middlewares.https_redirect.redirectScheme]
    scheme = "https"
    permanent = true

  [http.middlewares.proxy-auth-Name.forwardAuth]
    address = "http://172.18.25.159:8888/proxy_auth/"

and traefik.toml reads

[entryPoints]
  [entryPoints.traefik]
    address = "172.18.25.159:8081"

  [entryPoints.http]
    address = ":10080"

  [entryPoints.https]
    address = ":10443"

[providers]
  providersThrottleDuration = "2s"
  [providers.file]
    directory = "/opt/traefik/routes/"
    watch = true

[api]
  dashboard = true

[ping]

[log]
  level = "INFO"
  filePath = "/var/log/traefik/traefik.log"

[accessLog]
  bufferingSize = 0

Any help is appreciated... proxy-auth-Name only appears with forwardAuth in traefik.toml, and that's all

You need to define proxy-auth-Name before you can assign it.

Note that your static.toml isn’t static, but a dynamic configuration. Your traefik.toml is the real static config (using elements like entrypoints).

Thanks, but where should I define it exactly? I'm new to Traefik. I thought the following was enough as a definition

[http.middlewares]
#...
#...
  [http.middlewares.proxy-auth-Name.forwardAuth]
      address = "http://172.18.25.159:8888/proxy_auth/"

Both, my static.toml and dynamic.toml are in the same routes directory, this is not enough?

Sorry, didn’t see it at the bottom. And I hate toml for the unnecessary repetition of words :wink:

Config seems according to doc.

Have you tried without "@file" or is that just in the error message?

Maybe it’s an issue with the order of the loading of the dynamic files. Have you tried to merge it into one?