Middleware via environment variable

Hi all,

Is it possible to create a middleware from environment variable ?
I didnt find anything about this topic in the documentation.
otherwise is it possible to create a middleware directly via a label on the traefik container ?
I tried this and the middleware did not show up in the list.

Best Regards,

Loïc Hermann

Hello,

the middlewares are a part of the dynamic configuration so it can be define with:

  • a file
  • labels (docker, rancher, marathon, ...)
  • k8s CRD

The static configuration can be define with:

  • a file
  • CLI flags
  • Env vars

https://docs.traefik.io/v2.1/providers/overview/


To define a middleware with labels:

  • you open the doc of middleware that you want ot use.
  • click on the Docker tab (it's the default tab)
  • copy paste the labels
  • add a reference of the middleware in your router definition.

Recommend read: