I tried to solve this by using the file backend so that the number of labels in my docker-compose.yml
will be reduced. In my setup I used my own traefik Docker container that already ships with the configuration. I don't know if this is useful or not (and may or may not be included in the documentation) but I wanted to share it anyway:
- static configuration
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
- dynamic configuration
# dummy service
[http.services.DefaultHTTPSRedirect.loadBalancer]
[[http.services.DefaultHTTPSRedirect.loadBalancer.servers]]
url = "http://localhost/"
# router with PathPrefix /, so everything will be matched
[http.routers.DefaultHTTPSRedirect]
entryPoints = [ "http" ]
rule = "PathPrefix(`/`)"
middlewares = [ "DefaultHTTPSRedirect" ]
service = "DefaultHTTPSRedirect"
# lowest possible priority so that the match can be overwritten by anyone
priority = 1
[http.middlewares.DefaultHTTPSRedirect.RedirectScheme]
scheme = "https"
permanent = true