This should work for the HTTPS router pointing to the service listening on HTTPS, shouldn't it?
However, i have two questions:
What is the proper syntax for adding multiple middlewares to a router with labels for a docker container definition? The documentation says: A list. Since i am defining the containers via the ansible docker_container module, one could assume a list in yaml style, but that cannot apply for a "simple" docker run command.
What does the redirect@file middleware do? It is copypasted from the docs, but according to the docs there does not exist a redirect@file middleware. Wouldn't a RedirectScheme be more appropriate, like described in the lists of middlewares?
Maybe someone can help me accomplish my goal of translating the above v1 snippet to a v2 snippet which does the same, so i can adapt it to my other services.
I'm also still learning and deciphering the documentation, but I think this will help...
First, the @file syntax is a provider reference to dynamic file configuration. In order for your labels to work, you'd load a dynamic configuration that contained something like the following:
Note that "redirect" and "auth" are arbitrary names we're using in this example that reference the middleware configuration.
Then, because I don't believe they're referring to a YAML list rather than a literal list, in order to load both auth and redirect middlewares, I believe you'd do:
@emce No, you got it right. redirect@file is indeed how you refer to a middleware arbitrarily named redirect, which would be defined for the file provider, i.e. in a dynamic file configuration.
Thanks for your answers. They have helped me a bit. However, currently i am struggling with the dynamic file configuration.
I have created a directory called conf.d and mounted it in /conf.d in the traefik container.
I reference this directory in the traefik.yaml with the following snippet:
providers:
file:
directory: /conf.d
watch: true
Inside this directory there is a file called redirect.yaml with the following content:
I already was successful with accessing the dashboard via plaintext HTTP, but the currrent configuration gives me these errors:
time="2019-09-19T08:37:26Z" level=info msg="Configuration loaded from file: /traefik.yaml"
time="2019-09-19T08:37:27Z" level=error msg="middleware \"redirect@file\" does not exist" entryPointName=web routerName=api@docker
time="2019-09-19T08:37:27Z" level=error msg="middleware \"redirect@file\" does not exist" entryPointName=web-secure routerName=api@docker
time="2019-09-19T08:37:27Z" level=error msg="middleware \"redirect@file\" does not exist" entryPointName=traefik routerName=api@docker
I fixed it. I didn't notice i already had a provider section for docker. Now everything's fine. Next step: Catchall HTTPS redirect, but i'll look into @EugenMayer s thread for that.