exoframejs/exoframe

Allow using custom traefik middlewares from exoframe config

yamalight opened this issue · 0 comments

Currently there's no way to define additional custom middleware via exoframe config because Traefik v2.0 requires new middlewares to be explicitly included into the list on router.
There are two possible options:

  1. Automatically parse all given user labels, look for labels that start with traefik.http.middlewares, extract name and auto-add it to middlewares list, e.g. adding redirect would be:
{
  "labels": {
    "traefik.http.middlewares.my-redirectregex.redirectregex.regex": "^https://domain.redirect/(.*)",
    "traefik.http.middlewares.my-redirectregex.redirectregex.replacement": "https://domain.new/$${1}"
  }
}
  1. Introduce additional middlewares property that should list middlewares in traefik format, e.g. adding redirect would be:
{
  "labels": {
    "traefik.http.middlewares.my-redirectregex.redirectregex.regex": "^https://domain.redirect/(.*)",
    "traefik.http.middlewares.my-redirectregex.redirectregex.replacement": "https://domain.new/$${1}"
  },
  "middlewares": ["my-redirectregex@docker"],
}

First option is easier for basic stuff, while second is more powerful (allows using middlewares from traefik config, etc). Maybe a combination of two would be best.