Http to https redirection using docker-compose and letsencrypt http challenge

Hi there,

we've setup traefik with letsencrypt using http challenge: this part is working like a charm.

We're now also trying to make sure that all http traffic is redirected to https and for some reason, we cannot get this to work. We're only using docker-compose.yml.

Our setup is as follows:

version: "3.3"

    image: "traefik:v2.5.1"
    container_name: "traefik"
    restart: unless-stopped
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - ""
      - ""
    network_mode: "host"
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

    image: "traefik/whoami"
    container_name: "simple-service"
      - traefik.enable=true
      - traefik.http.middlewares.mywebserver-redirect-websecure.redirectscheme.scheme=https
      - traefik.http.routers.mywebserver-web.middlewares=mywebserver-redirect-websecure
      - traefik.http.routers.mywebserver-web.rule=Host(``)
      - traefik.http.routers.mywebserver-web.entrypoints=web
      - traefik.http.routers.mywebserver-websecure.rule=Host(``)
      - traefik.http.routers.mywebserver-websecure.tls.certresolver=myresolver
      - traefik.http.routers.mywebserver-websecure.tls=true
      - traefik.http.routers.mywebserver-websecure.entrypoints=websecure

When we navigate to, we get to see the expected output. If we however navigate to, the request in chrome developer tools is first pending but then times out.

What are we doing wrong?

Edit: I also tried to add global redirection in the traefik service itself but this results in the same behaviour. See yaml below:

      - "--providers.docker"
      - "--entrypoints.web.address=:80"
      - ""
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"