# Error loading file

**URL:** <https://community.traefik.io/t/error-loading-file/2452>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [October 18, 2019, 12:51pm UTC](https://community.traefik.io/t/error-loading-file/2452 "2019-10-18T12:51:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunoamaral](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/brunoamaral/32/917_2.png) [@brunoamaral](https://community.traefik.io/u/brunoamaral)\
**Post date:** [October 18, 2019, 12:51pm UTC](https://community.traefik.io/t/error-loading-file/2452/1 "2019-10-18T12:51:40Z")

</div>

I am trying to setup HomeAssistant, which needs network\_mode set to Host. And so I created a new servers.toml file but I'm getting an error.

`Cannot start the provider *file.Provider: toml: type mismatch for dynamic.RouterTLSConfig: expected table but found bool"`

```auto
[entryPoints]
  [entryPoints.homeassistant]
    address = ":8123"

[http]
  [http.routers]
    [http.routers.homeassistant]
      entryPoints = ["homeassistant"]
      rule = "Host(`DOMAIN.TLD`)"
      service = "homeassistant"
      tls = true

  [http.services]
    [http.services.homeassistant]
      [[http.services.homeassistant.loadBalancer.servers]]
        url = "http://192.168.1.10:8123"
        passHostHeader = true
        
[tcp]
  [tcp.routers]
    [tcp.routers.homeassistant]
      entryPoints = "http"
      rule = "Host(`DOMAIN.TLD`)"
      service = "homeassistant"
      [tcp.routers.homeassistant.tls]
        passthrough = true

  [tcp.services.homeassistant]
    [[tcp.services.homeassistant.loadBalancer.servers]]
      url = "http://192.168.1.10:8123"
      passHostHeader = true

  [http.middlewares]
    [http.middlewares.homeassistant]
      browserXSSFilter = true
      contentTypeNosniff = true
      forceSTSHeader = true
      SSLHost = "brunoamaral.net"
      SSLRedirect = true
      STSIncludeSubdomains = true
      STSPreload = true
      STSSeconds = 315360000

    [http.middlewares.testHeader.headers]
      FrameDeny = true
      SSLRedirect = true

```

I checked and the toml format is valid, but maybe I am missing something specific to traefik ?

---

<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:** [October 18, 2019, 2:45pm UTC](https://community.traefik.io/t/error-loading-file/2452/2 "2019-10-18T14:45:15Z")

</div>

Hello,

1. in Traefik, the static configuration and the dynamic configuration must be in 2 files.
2. `tls = true` is not a valid option for the file provider.

- `traefik.toml`:

```auto
[entryPoints]
  [entryPoints.homeassistant]
    address = ":8123"

[providers.file]
  directory = "/config"

```

- `config/dyn.toml`:

```auto
[http]
  [http.routers]
    [http.routers.homeassistant]
      entryPoints = ["homeassistant"]
      rule = "Host(`DOMAIN.TLD`)"
      service = "homeassistant"
      [http.routers.homeassistant.tls]

  [http.services]
    [http.services.homeassistant]
      [[http.services.homeassistant.loadBalancer.servers]]
        url = "http://192.168.1.10:8123"
        passHostHeader = true
        
[tcp]
  [tcp.routers]
    [tcp.routers.homeassistant]
      entryPoints = "http"
      rule = "Host(`DOMAIN.TLD`)"
      service = "homeassistant"
      [tcp.routers.homeassistant.tls]
        passthrough = true

  [tcp.services.homeassistant]
    [[tcp.services.homeassistant.loadBalancer.servers]]
      url = "http://192.168.1.10:8123"
      passHostHeader = true

  [http.middlewares]
    [http.middlewares.homeassistant]
      browserXSSFilter = true
      contentTypeNosniff = true
      forceSTSHeader = true
      SSLHost = "brunoamaral.net"
      SSLRedirect = true
      STSIncludeSubdomains = true
      STSPreload = true
      STSSeconds = 315360000

    [http.middlewares.testHeader.headers]
      FrameDeny = true
      SSLRedirect = true

```

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/brunoamaral/32/917_2.png) [@brunoamaral](https://community.traefik.io/u/brunoamaral)\
**Post date:** [October 18, 2019, 4:03pm UTC](https://community.traefik.io/t/error-loading-file/2452/3 "2019-10-18T16:03:10Z")

</div>

Thanks again @ldez !

Seems that I also had some stuff that wasn't required by HomeAssistant. Here's the final servers.toml in case someone else is looking for a solution:

```auto
[http]
  [http.routers]
    [http.routers.homeassistant]
      entryPoints = ["https"]
      rule = "Host(`DOMAIN.TLD`)"
      service = "homeassistant"
      [http.routers.homeassistant.tls]

  [http.services]
    [http.services.homeassistant]
      [[http.services.homeassistant.loadBalancer.servers]]
        url = "http://192.168.1.10:8123"
        passHostHeader = true

  [tcp.services.homeassistant]
    [[tcp.services.homeassistant.loadBalancer.servers]]
      url = "http://192.168.1.10:8123"
      passHostHeader = true

  [http.middlewares]
    [http.middlewares.homeassistant]
      browserXSSFilter = true
      contentTypeNosniff = true
      forceSTSHeader = true
      SSLHost = "DOMAIN.TLD"
      SSLRedirect = true
      STSIncludeSubdomains = true
      STSPreload = true
      STSSeconds = 315360000

    [http.middlewares.testHeader.headers]
      FrameDeny = true
      SSLRedirect = true

```
