Redirect scheme (http to https) not working

What did you do?

I have the following docker-compose file for traefik:

version: '3.7'
services:
  traefik:
    image: "traefik:v2.1.4"
    container_name: "traefik"
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myhttpchallenge.acme.email=test@test.de”
      - "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
      - "--api.dashboard=true"
      - "--api.insecure=true"
    ports:
      - "80:80"
      - "443:443"
        #      - "8080:8080"
    labels:
      - "traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)"
      - "traefik.http.routers.http_catchall.entrypoints=web"
      - "traefik.http.routers.http_catchall.middlewares=https_redirect"
      - "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.https_redirect.redirectscheme.permanent=true"
    volumes:
      - "/mnt/bigdata/docker/traefik/letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
  default:
    external:
      name: traefik

And I have a wordpress instance looking like the follows:

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    container_name: wordpress-latest
    environment:
      WORDPRESS_DB_HOST: dd
      WORDPRESS_DB_USER: dd
      WORDPRESS_DB_PASSWORD: dd
      WORDPRESS_DB_NAME: dd
    labels:
      - "traefik.http.routers.wordpress.rule=Host(`url1.de`) || Host(`url2.de`)”
      - "traefik.enable=true"
      - "traefik.http.routers.wordpress.entrypoints=websecure"
      - "traefik.http.routers.wordpress.tls.certresolver=myhttpchallenge"
      - "traefik.http.services.wordpress.loadbalancer.server.port=80"
    volumes:
      - /var/lib/wordpress/html:/var/www/html


  mysqlWordpress:
    image: mysql:5.7
    container_name: wordpress-db
    hostname: mysqlWordpress
    restart: always
    expose:
      - 3306
    environment:
      MYSQL_DATABASE: dd
      MYSQL_USER: dd
      MYSQL_PASSWORD: dd
    volumes:
      - /var/lib/wordpress/mysql:/var/lib/mysql

networks:
  default:
    external:
      name: traefik

What did you expect to see?

When I visit http://url1.de or http://url2.de I get redirected to https://url1.de or https://url2.de

What did you see instead?

I see the following error: 404 page not found and no redirect.

Output of traefik version: (What version of Traefik are you using?)

traefik:v2.1.4

If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)

time="2020-02-17T15:23:22Z" level=info msg="Configuration loaded from flags."
time="2020-02-17T15:23:22Z" level=info msg="Traefik version 2.1.4 built on 2020-02-06T17:10:06Z"
time="2020-02-17T15:23:22Z" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"traefik\":{\"address\":\":8080\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}},\"web\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}},\"websecure\":{\"address\":\":443\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}}},\"providers\":{\"providersThrottleDuration\":2000000000,\"docker\":{\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}},\"api\":{\"insecure\":true,\"dashboard\":true},\"log\":{\"level\":\"DEBUG\",\"format\":\"common\"},\"certificatesResolvers\":{\"myhttpchallenge\":{\"acme\":{\"email\":\"test@test.de\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/letsencrypt/acme.json\",\"keyType\":\"RSA4096\",\"httpChallenge\":{\"entryPoint\":\"web\"}}}}}"
time="2020-02-17T15:23:22Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"
time="2020-02-17T15:23:22Z" level=debug msg="Start TCP Server" entryPointName=websecure
time="2020-02-17T15:23:22Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2020-02-17T15:23:22Z" level=debug msg="Start TCP Server" entryPointName=traefik
time="2020-02-17T15:23:22Z" level=debug msg="Start TCP Server" entryPointName=web
time="2020-02-17T15:23:22Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}"
time="2020-02-17T15:23:22Z" level=info msg="Starting provider *acme.Provider {\"email\":\"test@test.de\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/letsencrypt/acme.json\",\"keyType\":\"RSA4096\",\"httpChallenge\":{\"entryPoint\":\"web\"},\"ResolverName\":\"myhttpchallenge\",\"store\":{},\"ChallengeStore\":{}}"
time="2020-02-17T15:23:22Z" level=info msg="Testing certificate renew..." providerName=myhttpchallenge.acme
time="2020-02-17T15:23:22Z" level=info msg="Starting provider *traefik.Provider {}"
time="2020-02-17T15:23:22Z" level=debug msg="Configuration received from provider myhttpchallenge.acme: {\"http\":{},\"tls\":{}}" providerName=myhttpchallenge.acme
time="2020-02-17T15:23:22Z" level=debug msg="Configuration received from provider internal: {\"http\":{\"routers\":{\"api\":{\"entryPoints\":[\"traefik\"],\"service\":\"api@internal\",\"rule\":\"PathPrefix(`/api`)\",\"priority\":2147483646},\"dashboard\":{\"entryPoints\":[\"traefik\"],\"middlewares\":[\"dashboard_redirect@internal\",\"dashboard_stripprefix@internal\"],\"service\":\"dashboard@internal\",\"rule\":\"PathPrefix(`/`)\",\"priority\":2147483645}},\"middlewares\":{\"dashboard_redirect\":{\"redirectRegex\":{\"regex\":\"^(http:\\\\/\\\\/[^:\\\\/]+(:\\\\d+)?)\\\\/$\",\"replacement\":\"${1}/dashboard/\",\"permanent\":true}},\"dashboard_stripprefix\":{\"stripPrefix\":{\"prefixes\":[\"/dashboard/\",\"/dashboard\"]}}},\"services\":{\"api\":{},\"dashboard\":{}}},\"tcp\":{},\"tls\":{}}" providerName=internal
time="2020-02-17T15:23:22Z" level=debug msg="Adding certificate for domain(s) url2.de,url1.de"
time="2020-02-17T15:23:22Z" level=debug msg="Adding certificate for domain(s) monlightgrid.de"
time="2020-02-17T15:23:22Z" level=debug msg="No default certificate, generating one"
time="2020-02-17T15:23:22Z" level=debug msg="Provider connection established with docker 19.03.5 (API 1.40)" providerName=docker
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=mysqlWordpress-newdocker-00fcdea83492814bb981ac41cc9736bdcc288cfd196c46271380bf341bf547c2
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=db-newdocker-c78f48c9493baa3bdaa3a3292e91191721bd3145a18071149c8ce738d8a82c4b
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=php-newdocker-d4fb04a25531ec10128af583cb92376db3bd13a16ca16350163a64bd83a0f147
time="2020-02-17T15:23:22Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"monlight\":{\"service\":\"monlight\",\"rule\":\"(Host(`monlightgrid.de`))\"},\"moodle\":{\"entryPoints\":[\"websecure\"],\"service\":\"moodle\",\"rule\":\"(Host(`url2.de`) || Host(`url1.de`)) \\u0026\\u0026 PathPrefix(`/moodle`)\",\"tls\":{\"certResolver\":\"myhttpchallenge\"}},\"wordpress\":{\"entryPoints\":[\"websecure\"],\"service\":\"wordpress\",\"rule\":\"Host(`url2.de`) || Host(`url1.de`)\",\"tls\":{\"certResolver\":\"myhttpchallenge\"}}},\"services\":{\"monlight\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.5:80\"}],\"passHostHeader\":true}},\"moodle\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.7:80\"}],\"passHostHeader\":true}},\"wordpress\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.3:80\"}],\"passHostHeader\":true}}}},\"tcp\":{}}" providerName=docker
time="2020-02-17T15:23:22Z" level=debug msg="Provider event received {Status:start ID:8b539997b6672ce0ddffae5dcccf4ae3db97e7b6f557190e32bf61a7f704c47a From:traefik:v2.1.4 Type:container Action:start Actor:{ID:8b539997b6672ce0ddffae5dcccf4ae3db97e7b6f557190e32bf61a7f704c47a Attributes:map[com.docker.compose.config-hash:d56d726c724463eebe2ab19f3759478a9ea680bfd49dbe613b324d20052f6f3a com.docker.compose.container-number:1 com.docker.compose.oneoff:False com.docker.compose.project:newdocker com.docker.compose.service:traefik com.docker.compose.version:1.22.0 image:traefik:v2.1.4 name:traefik org.opencontainers.image.description:A modern reverse-proxy org.opencontainers.image.documentation:https://docs.traefik.io org.opencontainers.image.title:Traefik org.opencontainers.image.url:https://traefik.io org.opencontainers.image.vendor:Containous org.opencontainers.image.version:v2.1.4 traefik.http.middlewares.https_redirect.redirectscheme.permanent: true: traefik.http.middlewares.https_redirect.redirectscheme.scheme: https: traefik.http.routers.http_catchall.entrypoints: web: traefik.http.routers.http_catchall.middlewares: https_redirect: traefik.http.routers.http_catchall.rule: HostRegexp(`{any:.+}`):]} Scope:local Time:1581953002 TimeNano:1581953002893796758}" providerName=docker
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=traefik-newdocker-8b539997b6672ce0ddffae5dcccf4ae3db97e7b6f557190e32bf61a7f704c47a
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=mysqlWordpress-newdocker-00fcdea83492814bb981ac41cc9736bdcc288cfd196c46271380bf341bf547c2
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=db-newdocker-c78f48c9493baa3bdaa3a3292e91191721bd3145a18071149c8ce738d8a82c4b
time="2020-02-17T15:23:22Z" level=debug msg="Filtering disabled container" providerName=docker container=php-newdocker-d4fb04a25531ec10128af583cb92376db3bd13a16ca16350163a64bd83a0f147
time="2020-02-17T15:23:22Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"monlight\":{\"service\":\"monlight\",\"rule\":\"(Host(`monlightgrid.de`))\"},\"moodle\":{\"entryPoints\":[\"websecure\"],\"service\":\"moodle\",\"rule\":\"(Host(`url2.de`) || Host(`url1.de`)) \\u0026\\u0026 PathPrefix(`/moodle`)\",\"tls\":{\"certResolver\":\"myhttpchallenge\"}},\"wordpress\":{\"entryPoints\":[\"websecure\"],\"service\":\"wordpress\",\"rule\":\"Host(`url2.de`) || Host(`url1.de`)\",\"tls\":{\"certResolver\":\"myhttpchallenge\"}}},\"services\":{\"monlight\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.5:80\"}],\"passHostHeader\":true}},\"moodle\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.7:80\"}],\"passHostHeader\":true}},\"wordpress\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.19.0.3:80\"}],\"passHostHeader\":true}}}},\"tcp\":{}}" providerName=docker
time="2020-02-17T15:23:23Z" level=debug msg="Adding certificate for domain(s) url2.de,url1.de"
time="2020-02-17T15:23:23Z" level=debug msg="Adding certificate for domain(s) monlightgrid.de"
time="2020-02-17T15:23:23Z" level=debug msg="No default certificate, generating one"
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware api@internal" middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik routerName=api@internal
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix
time="2020-02-17T15:23:23Z" level=debug msg="Adding tracing to middleware" middlewareName=dashboard_stripprefix@internal entryPointName=traefik routerName=dashboard@internal
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2020-02-17T15:23:23Z" level=debug msg="Setting up redirection from ^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$ to ${1}/dashboard/" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
time="2020-02-17T15:23:23Z" level=debug msg="Adding tracing to middleware" middlewareName=dashboard_redirect@internal entryPointName=traefik routerName=dashboard@internal
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2020-02-17T15:23:23Z" level=debug msg="Adding certificate for domain(s) url2.de,url1.de"
time="2020-02-17T15:23:23Z" level=debug msg="Adding certificate for domain(s) monlightgrid.de"
time="2020-02-17T15:23:23Z" level=debug msg="No default certificate, generating one"
time="2020-02-17T15:23:23Z" level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [web websecure traefik]" routerName=monlight@docker
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=web serviceName=monlight middlewareType=Pipelining middlewareName=pipelining routerName=monlight@docker
time="2020-02-17T15:23:23Z" level=debug msg="Creating load-balancer" routerName=monlight@docker entryPointName=web serviceName=monlight
time="2020-02-17T15:23:23Z" level=debug msg="Creating server 0 http://172.19.0.5:80" serverName=0 routerName=monlight@docker entryPointName=web serviceName=monlight
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware monlight" routerName=monlight@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=web
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=web
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=websecure
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware api@internal" routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" middlewareType=StripPrefix entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
time="2020-02-17T15:23:23Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
time="2020-02-17T15:23:23Z" level=debug msg="Setting up redirection from ^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$ to ${1}/dashboard/" middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2020-02-17T15:23:23Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=websecure routerName=moodle@docker serviceName=moodle middlewareName=pipelining middlewareType=Pipelining
time="2020-02-17T15:23:23Z" level=debug msg="Creating load-balancer" entryPointName=websecure routerName=moodle@docker serviceName=moodle
time="2020-02-17T15:23:23Z" level=debug msg="Creating server 0 http://172.19.0.7:80" entryPointName=websecure routerName=moodle@docker serviceName=moodle serverName=0
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware moodle" routerName=moodle@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=websecure
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" middlewareType=Pipelining routerName=wordpress@docker entryPointName=websecure serviceName=wordpress middlewareName=pipelining
time="2020-02-17T15:23:23Z" level=debug msg="Creating load-balancer" routerName=wordpress@docker entryPointName=websecure serviceName=wordpress
time="2020-02-17T15:23:23Z" level=debug msg="Creating server 0 http://172.19.0.3:80" serviceName=wordpress serverName=0 routerName=wordpress@docker entryPointName=websecure
time="2020-02-17T15:23:23Z" level=debug msg="Added outgoing tracing middleware wordpress" entryPointName=websecure routerName=wordpress@docker middlewareType=TracingForwarder middlewareName=tracing
time="2020-02-17T15:23:23Z" level=debug msg="Creating middleware" entryPointName=websecure middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2020-02-17T15:23:23Z" level=debug msg="Try to challenge certificate for domain [url2.de url1.de] found in HostSNI rule" routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)" providerName=myhttpchallenge.acme
time="2020-02-17T15:23:23Z" level=debug msg="Try to challenge certificate for domain [url2.de url1.de] found in HostSNI rule" providerName=myhttpchallenge.acme routerName=wordpress@docker rule="Host(`url2.de`) || Host(`url1.de`)"
time="2020-02-17T15:23:23Z" level=debug msg="Looking for provided certificate(s) to validate [\"url2.de\" \"url1.de\"]..." providerName=myhttpchallenge.acme routerName=wordpress@docker rule="Host(`url2.de`) || Host(`url1.de`)"
time="2020-02-17T15:23:23Z" level=debug msg="Looking for provided certificate(s) to validate [\"url2.de\" \"url1.de\"]..." providerName=myhttpchallenge.acme routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)"
time="2020-02-17T15:23:23Z" level=debug msg="No ACME certificate generation required for domains [\"url2.de\" \"url1.de\"]." routerName=wordpress@docker rule="Host(`url2.de`) || Host(`url1.de`)" providerName=myhttpchallenge.acme
time="2020-02-17T15:23:23Z" level=debug msg="No ACME certificate generation required for domains [\"url2.de\" \"url1.de\"]." routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)" providerName=myhttpchallenge.acme
time="2020-02-17T15:23:24Z" level=debug msg="Adding certificate for domain(s) url2.de,url1.de"
time="2020-02-17T15:23:24Z" level=debug msg="Adding certificate for domain(s) monlightgrid.de"
time="2020-02-17T15:23:24Z" level=debug msg="No default certificate, generating one"
time="2020-02-17T15:23:25Z" level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [web websecure traefik]" routerName=monlight@docker
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=pipelining middlewareType=Pipelining entryPointName=traefik routerName=monlight@docker serviceName=monlight
time="2020-02-17T15:23:25Z" level=debug msg="Creating load-balancer" entryPointName=traefik routerName=monlight@docker serviceName=monlight
time="2020-02-17T15:23:25Z" level=debug msg="Creating server 0 http://172.19.0.5:80" routerName=monlight@docker serverName=0 serviceName=monlight entryPointName=traefik
time="2020-02-17T15:23:25Z" level=debug msg="Added outgoing tracing middleware monlight" routerName=monlight@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
time="2020-02-17T15:23:25Z" level=debug msg="Added outgoing tracing middleware api@internal" middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik routerName=api@internal
time="2020-02-17T15:23:25Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix
time="2020-02-17T15:23:25Z" level=debug msg="Adding tracing to middleware" routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal entryPointName=traefik
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal
time="2020-02-17T15:23:25Z" level=debug msg="Setting up redirection from ^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$ to ${1}/dashboard/" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
time="2020-02-17T15:23:25Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery entryPointName=traefik middlewareType=Recovery
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" entryPointName=web middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" entryPointName=websecure middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=pipelining routerName=moodle@docker serviceName=moodle entryPointName=websecure middlewareType=Pipelining
time="2020-02-17T15:23:25Z" level=debug msg="Creating load-balancer" routerName=moodle@docker serviceName=moodle entryPointName=websecure
time="2020-02-17T15:23:25Z" level=debug msg="Creating server 0 http://172.19.0.7:80" routerName=moodle@docker serviceName=moodle serverName=0 entryPointName=websecure
time="2020-02-17T15:23:25Z" level=debug msg="Added outgoing tracing middleware moodle" routerName=moodle@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=websecure
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=pipelining middlewareType=Pipelining entryPointName=websecure routerName=wordpress@docker serviceName=wordpress
time="2020-02-17T15:23:25Z" level=debug msg="Creating load-balancer" serviceName=wordpress entryPointName=websecure routerName=wordpress@docker
time="2020-02-17T15:23:25Z" level=debug msg="Creating server 0 http://172.19.0.3:80" entryPointName=websecure routerName=wordpress@docker serviceName=wordpress serverName=0
time="2020-02-17T15:23:25Z" level=debug msg="Added outgoing tracing middleware wordpress" entryPointName=websecure routerName=wordpress@docker middlewareName=tracing middlewareType=TracingForwarder
time="2020-02-17T15:23:25Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=websecure
time="2020-02-17T15:23:25Z" level=debug msg="Try to challenge certificate for domain [url2.de url1.de] found in HostSNI rule" providerName=myhttpchallenge.acme routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)"
time="2020-02-17T15:23:25Z" level=debug msg="Try to challenge certificate for domain [url2.de url1.de] found in HostSNI rule" providerName=myhttpchallenge.acme routerName=wordpress@docker rule="Host(`url2.de`) || Host(`url1.de`)"
time="2020-02-17T15:23:25Z" level=debug msg="Looking for provided certificate(s) to validate [\"url2.de\" \"url1.de\"]..." providerName=myhttpchallenge.acme routerName=wordpress@docker rule="Host(`url2.de`) || Host(`url1.de`)"
time="2020-02-17T15:23:25Z" level=debug msg="Looking for provided certificate(s) to validate [\"url2.de\" \"url1.de\"]..." providerName=myhttpchallenge.acme routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)"
time="2020-02-17T15:23:25Z" level=debug msg="No ACME certificate generation required for domains [\"url2.de\" \"url1.de\"]." rule="Host(`url2.de`) || Host(`url1.de`)" providerName=myhttpchallenge.acme routerName=wordpress@docker
time="2020-02-17T15:23:25Z" level=debug msg="No ACME certificate generation required for domains [\"url2.de\" \"url1.de\"]." providerName=myhttpchallenge.acme routerName=moodle@docker rule="(Host(`url2.de`) || Host(`url1.de`)) && PathPrefix(`/moodle`)":$

Hello,

I mixed 2 labels syntax: in YAML you can use both syntax to define the value of a map (labels are a map)

Syntax with - at the beginning of the line and = as separator between the key and the value:

myMap:
  - "key1=value1"
  - "key2=value2"
  - "key3=value3"

Syntax without - and with : as separator between the key and the value:

myMap:
  key1: value1
  key2: value2
  key3: value3

so:

    labels:
      traefik.http.routers.http_catchall.rule: HostRegexp(`{any:.+}`)
      traefik.http.routers.http_catchall.entrypoints: web
      traefik.http.routers.http_catchall.middlewares: https_redirect
      traefik.http.middlewares.https_redirect.redirectscheme.scheme: https
      traefik.http.middlewares.https_redirect.redirectscheme.permanent: true

or

    labels:
      - "traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)"
      - "traefik.http.routers.http_catchall.entrypoints=web"
      - "traefik.http.routers.http_catchall.middlewares=https_redirect"
      - "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.https_redirect.redirectscheme.permanent=true"

Hi Idez,

I have changed my compose-file as you suggested (the second syntax). I have changed my post accordingly. But still the same result. No redirect to https

You have to add - "traefik.enable=true" on the traefik container.

version: '3.7'

services:
  traefik:
    image: traefik:v2.1.4
    container_name: traefik
    command:
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --certificatesresolvers.myhttpchallenge.acme.httpchallenge=true
      - --certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web
      - --certificatesresolvers.myhttpchallenge.acme.email=test@test.de
      - --certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json
      - --api.dashboard=true
      - --api.insecure=true
    ports:
      - 80:80
      - 443:443
    volumes:
      - /mnt/bigdata/docker/traefik/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      traefik.enable: true
      traefik.http.routers.http_catchall.rule: HostRegexp(`{any:.+}`)
      traefik.http.routers.http_catchall.entrypoints: web
      traefik.http.routers.http_catchall.middlewares: https_redirect
      traefik.http.middlewares.https_redirect.redirectscheme.scheme: https
      traefik.http.middlewares.https_redirect.redirectscheme.permanent: true

networks:
  default:
    external:
      name: traefik

Hi Idez,

now its working! Thank you. So without traefik.enable=true traefik is not even looking at the labels and their meaning?