Hi,
I am trying to implement http to https redirection with v2 on a swarm. I have been succesfull with a file provider, i.e. with
[http.routers]
[http.routers.web_router]
entryPoints = ["web"]
middlewares = ["https-redirect"]
rule = "HostRegexp(`{host:.+}`)"
service = "noop"
[http.services]
[http.services.noop.loadBalancer]
[[http.services.noop.loadBalancer.servers]]
url = "http://192.168.0.1"
[http.middlewares]
[http.middlewares.https-redirect.redirectScheme]
scheme = "https"
However, I can't seem to get Traefik read the docker labels on the swarm as provided in the yml file
version: "3.3"
services:
traefik:
image: "traefik:v2.0.0"
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker=true
- --log.level=DEBUG
ports:
- "80:80"
- "443:443"
deploy:
labels:
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.service=noop"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.services.noop.loadBalancer.servers.url=192.168.1.1"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
The router and middleware are not created. I have tried the "labels" section as a subsection of "deploy" and directly below the service.
What am I missing here?
Kind regards, Claus