redirectScheme set on route but not forcing scheme

I'm still fairly new to Traefik and so I still feel like I'm constantly fighting it :slight_smile:

That said, this one definitely seems.. not right. I've got a redirectscheme middleware setup for a domain (www.minetheftauto.com) and it doesn't seem to be forcing the redirect.

The middleware shows up on the dashboard, and also shows up in the router on the dashboard.

However, the HTTP call goes something like this:

Forgive the config for being a bit of a mess since its in rancher:

Are there any ideas as to why this wouldn't be redirecting?

I'm assuming you're using Traefik 2.x and hopefully at 2.2 since they simplified things for this one.

The CLI configuration you can use is

      --entrypoints.http.address=:80
      --entrypoints.http.http.redirections.entryPoint.to=https
      --entrypoints.http.http.redirections.entryPoint.scheme=https
      --entrypoints.http.http.redirections.entrypoint.permanent=true
      --entrypoints.https.address=:443

A full example of how I set it up is in Trajano base Docker swarm stacks (I just updated it today to use the new 2.2 constructs reducing a few lines of code in TOML.

Hello, I started using v2.2 in Docker and the global HTTPS redirection doesn't work for me.
I'm doing it in the static conf under /etc/traefik/traefik.toml.
It looks like this:

[entryPoints.web]
  address = ":80"
  [entryPoints.web.http.redirections.entryPoint]
    to = "websecure"
    scheme = "https"

[entryPoints.websecure]
  address = ":443"

I also see it in the log:

time="2020-04-21T13:34:59Z" level=debug msg="Added outgoing tracing middleware noop@internal" routerName=web-to-websecure@internal entryPointName=web middlewareName=tracing middlewareType=TracingForwarder
time="2020-04-21T13:34:59Z" level=debug msg="Creating middleware" middlewareType=RedirectScheme entryPointName=web routerName=web-to-websecure@internal middlewareName=redirect-web-to-websecure@internal
time="2020-04-21T13:34:59Z" level=debug msg="Setting up redirection to https 443" entryPointName=web routerName=web-to-websecure@internal middlewareName=redirect-web-to-websecure@internal middlewareType=RedirectScheme
time="2020-04-21T13:34:59Z" level=debug msg="Adding tracing to middleware" entryPointName=web routerName=web-to-websecure@internal middlewareName=redirect-web-to-websecure@internal

But it doesn't work for my Docker Container at all, it always resolves to http.
All my containers are setup like this:

labels:
  - traefik.enable=true
  - traefik.http.services.my-app.loadbalancer.server.port=80
  - traefik.http.routers.my-app.rule=Host(`my.domain.com`)
  - traefik.http.routers.my-app.entrypoints=web,websecure
labels:
  - traefik.enable=true
  - traefik.http.services.my-app.loadbalancer.server.port=80
  - traefik.http.routers.my-app.rule=Host(`my.domain.com`)
  - traefik.http.routers.my-app.entrypoints=websecure

Thank you for your replay. I tried it too, it doesn't work either.
The only think that works, if I define a redirectScheme middleware and assign it to for each container. But that's what I wanted to prevent with thew new feature. :frowning:

EDIT:
I have no idea if it's the reason, but I know added tls to each container and it works now.
Like this:

labels:
  - "traefik.enable=true"
  - "traefik.http.services.my-app.loadbalancer.server.port=80"
  - "traefik.http.routers.my-app.rule=Host(`my.domain.com`)"
  - "traefik.http.routers.my-app.entrypoints=web,websecure"
  - "traefik.http.routers.my-app.tls"