Multiple Routers and Middlewares

Hello,

I would like to make my services accessible from outside and use a local subdomain at the same time. My Traefik labels look like this:

  - traefik.enable=true
  - traefik.http.routers.change.entrypoints=https
  - traefik.http.routers.change.rule=Host(`change.domain.de`)
  - traefik.http.routers.change.tls.certresolver=le
  - traefik.http.services.change.loadbalancer.server.port=5000
  - traefik.http.routers.change.service=change
  - traefik.http.routers.change.middlewares=chain-no-auth@file
  - traefik.http.routers.change.middlewares=authelia@docker
  - traefik.http.routers.change_local.entrypoints=https
  - traefik.http.routers.change_local.rule=Host(`change.local.domain.de`)
  - traefik.http.routers.change_local.tls.certresolver=ionos
  - traefik.http.services.change_local.loadbalancer.server.port=5000
  - traefik.http.routers.change_local.service=change_local
  - traefik.http.routers.change_local.middlewares=chain-no-auth@file
  - traefik.http.routers.change_local.middlewares=internal-IPAllowList@file

This works so far that both subdomains are accessible. Unfortunately, the middlewares do not work for the router change_local. No matter which middleware I use, it is never used. Do I still have a syntax error here? How can I combine several middlewares? The log does not show any errors.

Thank you!

Middlewares are assigned with

.middlewares=ware1,ware2

Thank you for your answer. I have also tried that. It does not take any middleware for the second router, even if I have only defined one. In contrast, this works fine for the first router:

  - traefik.http.routers.change.middlewares=chain-no-auth@file
  - traefik.http.routers.change.middlewares=authelia@docker

I really have no idea why, but it works now. I've tried every possible combination and suspect I had a problem with the syntax somewhere. For the sake of completeness, here is the code:

      - traefik.enable=true
      - traefik.http.routers.change.entrypoints=https
      - traefik.http.routers.change.rule=Host(`change.domain.de`)
      - traefik.http.routers.change.tls.certresolver=le
      - traefik.http.services.change.loadbalancer.server.port=5000
      - traefik.http.routers.change.service=change
      - traefik.http.routers.change.middlewares=chain-no-auth@file
      - traefik.http.routers.change.middlewares=authelia@docker
      - traefik.http.routers.change-local.entrypoints=https
      - traefik.http.routers.change-local.rule=Host(`change.local.domain.de`)
      - traefik.http.routers.change-local.tls.certresolver=le
      - traefik.http.services.change-local.loadbalancer.server.port=5000
      - traefik.http.routers.change-local.service=change-local
      - traefik.http.routers.change-local.middlewares=chain-no-auth@file,internal-IPAllowList@file

I doubt that this works as intended, as you are overwriting the first one with the second one. I don’t think both will be used with this notation.

Thank you, of course you're right!