Problem with http -> https redirection

Hello,

After a quick review, I detected some mistakes.

In the static configuration file


The option debugLogGeneratedTemplate don't exist in v2 because there are no templates.


The API configuration must be change:

replace:

api:
  dashboard: true
  insecure: true
  debug: true

by

api: {}

The dashboard is true by default and I strongly advice against using insecure mode

labels:
  traefik.enable: true
  
  traefik.http.routers.traefik.entrypoints: https
  traefik.http.routers.traefik.rule: Host(`traefik.MY.URL`)
  traefik.http.routers.traefik.tls.certresolver: cloudflare
  traefik.http.routers.traefik.service: api@internal
  traefik.http.routers.traefik.middlewares: forward-auth@file

  traefik.http.services.traefik.loadbalancer.server.port: 9999 # noop require by swarm

The ping use a non-existing entry point, so try:

ping: {}

In this case the ping will the traefik entry point (port 8080).


In dynamic files


The global redirection:

http:
  routers:
    redirecttohttps:
      entryPoints:
        - web
      middlewares:
        - httpsredirect
      rule: "HostRegexp(`{host:.+}`)"
      service: noop

  services:
    # noop service, the URL will be never called
    noop:
      loadBalancer:
        servers:
          - url: "http://192.168.0.1"

  middlewares:
    httpsredirect:
      redirectScheme:
        scheme: https

In the secured chain: the middleware redirectScheme is "terminal", so I recommend to not add it with another middleware.


Recommend read


Also I recommend to migrate step by step, and take a look to your logs and the dashboard to get more information.