Middlewares on all routers but one

Hello !
I know I can associate a middleware to an entrypoint and that's awesome. However, I currently can't do that because I use authelia for my forwardAuth middleware and putting it in my entrypoint creates an infinite loop of redirection as authelia itself uses this entrypoint.

Here are the labels of the authelia container:

labels:
  - "traefik.enable=true"
  - "traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://authelia.{{ domain_name }}/"
  - "traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true"
  - "traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User, Remote-Groups"

and my entrypoints in my static config:

entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: ":443"
    http:
      tls:
        certResolver: default
        domains:
          - main: "{{ domain_name }}"
            sans:
              - "*.{{ domain_name }}"

But I would like to have:

websecure:
  address: ":443"
  http:
    middlewares:
      - authelia@docker

with the middleware not applying to authelia itself somehow. Is that currently possible?

Hello,

currently it's not possible: the middleware is applied on all routers.

I see, thanks for the fast reply :slight_smile: