Hello,
To use the file provider (dynamic configuration from a file) to have to activate it (like for Traefik v1).
Also in Traefik v2, you have to use different file for the static configuration and the dynamic configuration.
traefik.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web-secure]
address = ":443"
[api]
dashboard = true
insecure = true
[log]
filePath = "/logs/traefik.log"
level = "DEBUG"
[accessLog]
filePath = "/logs/access.log"
[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]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
network = "portainer"
[providers.file]
directory = "/path/to/dyn/"
/path/to/dyn/myfile.toml
# Global https redirect
[http.routers]
[http.routers.redirecttohttps]
entryPoints = ["web"]
middlewares = ["httpsredirect"]
rule = "HostRegexp(`{host:.+}`)"
service = "noop"
[http.services]
# noop service, the URL will be never called
[http.services.noop.loadBalancer]
[[http.services.noop.loadBalancer.servers]]
url = "http://192.168.0.1"
[http.middlewares]
[http.middlewares.httpsredirect.redirectScheme]
scheme = "https"
permanent = true
Recommend read: