Hi,
I am struggling to get the Global HTTPS redirect to work when using docker and the traefik.toml to set the settings in V2. I have followed the blog post, the other forum posts here but none seem to do it in the TOML file and when translating the docker-compose to TOML it won't work - keep getting a 404 error when accessing HTTP sites with no redirect. HTTPS works fine.
Traefik.toml:
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web-secure]
address = ":443"
[certificatesResolvers.portainer.acme]
email = "xxx@email.com"
storage = "acme.json"
[certificatesResolvers.portainer.acme.dnsChallenge]
provider = "digitalocean"
delayBeforeCheck = 90
resolvers = ["1.1.1.1:53", "8.8.8.8:53"]
[providers.docker]
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
network = "portainer"
[api]
dashboard = true
insecure = true
[log]
filePath = "/logs/traefik.log"
level = "DEBUG"
[accessLog]
filePath = "/logs/access.log"
# Global https redirect
# Defining the middleware doing the work
[http.middlewares]
[http.middlewares.redirect-to-https.redirectScheme]
scheme = "https"
permanent = true
# Defining what route will use the middleware
[http.routers]
[http.routers.redirs]
rule = "HostRegexp(`{host:.+}`)"
entryPoints = ["web"]
middlewares = ["redirect-to-https"]
And the specific docker container labels:
traefik.enable = true
traefik.http.routers.onlyoffice.entrypoints = web-secure
traefik.http.routers.onlyoffice.rule = Host(`xxx.xxx.com`)
traefik.http.routers.onlyoffice.tls.certresolver = portainer
traefik.http.services.onlyoffice.loadbalancer.server.port = 80
Thank you for any help!