# Global Docker HTTPS redirect using TOML

**URL:** <https://community.traefik.io/t/global-docker-https-redirect-using-toml/3595>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [December 27, 2019, 12:14pm UTC](https://community.traefik.io/t/global-docker-https-redirect-using-toml/3595 "2019-12-27T12:14:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [December 27, 2019, 1:39pm UTC](https://community.traefik.io/t/global-docker-https-redirect-using-toml/3595/2 "2019-12-27T13:39:32Z")

</div>

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](https://docs.traefik.io/v2.1/getting-started/configuration-overview/#the-static-configuration) and the [dynamic configuration](https://docs.traefik.io/v2.1/getting-started/configuration-overview/#the-dynamic-configuration).

`traefik.toml`

```auto
[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`

```auto
# 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:

- [Global http to https redirect in v2](https://community.containo.us/t/global-http-to-https-redirect-in-v2/1658/3)
- [https://blog.containo.us/traefik-2-0-docker-101-fc2893944b9d](https://blog.containo.us/traefik-2-0-docker-101-fc2893944b9d)
- [https://github.com/containous/blog-posts/tree/master/2019\_09\_10-101\_docker](https://github.com/containous/blog-posts/tree/master/2019_09_10-101_docker)

---

_[View the full topic](https://community.traefik.io/t/global-docker-https-redirect-using-toml/3595)._
