HTTPS Redirection Default

Hello,

that is probably a FAQ, but despite browsing for days, I was not able to make it working. I try to install a redirection from HTTP to HTTPS for all services. My entire traefik.yaml looks like:


 log:
  level: DEBUG

providers:
  docker:
    exposedByDefault: false
    network: traefik_proxy

entrypoints:
  http:
    address: ":80"

  https:
    address: ":443"

http:
  routers:
    https-redirect:
      rule: "HostRegexp(`{any:.*}`)"
      entrypoints:
        - http
      middlewares:
        - https-redirect

  middlewares:
    https-redirect:
      redirectScheme:
        scheme: https
        permanent: true

certificatesResolvers:
  le:
    acme:
      tlschallenge: true
      email: "..."
      storage: "/letsencrypt/acme.json"

api:
  dashboard: true

The containers are configured using docker labels with docker-compose

whoami:
    image: "containous/whoami"
    container_name: "simple-service"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.invalid.org)"
      - "traefik.http.routers.whoami.entrypoints=https"
      - "traefik.http.routers.whoami.tls.certresolver=le"

They work fine, when using https directly.

However, when using http, I just get 404. What's still wrong with my configuration?

Thanks a lot!

Looks like you have the static config and the dynamic file provider in the same file. You need to separate them out.

Hey! Thanks for your reply! Could you be a bit more specific, as right now I am clueless what you are meaning.

The first code block is the traefik.yaml (static config), the second block is taken from a docker-compose.yaml. Is that what you mean?