# Default TLS should specificly be in "file" provider?

**URL:** <https://community.traefik.io/t/default-tls-should-specificly-be-in-file-provider/1690>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [September 18, 2019, 4:00pm UTC](https://community.traefik.io/t/default-tls-should-specificly-be-in-file-provider/1690 "2019-09-18T16:00:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aguay](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Aguay](https://community.traefik.io/u/Aguay)\
**Post date:** [September 18, 2019, 4:00pm UTC](https://community.traefik.io/t/default-tls-should-specificly-be-in-file-provider/1690/1 "2019-09-18T16:00:46Z")

</div>

Hi folks!

I'm using Traefik for a while and I would migrate to traefik v2.

I'm pretty confident with the usage of Traefik but something is making me lose my mind.  
I want to set a default certificate on my traefik server but I can't figure out why I have to configure it in the File provider.

Let me explain.

I have my main configuration file "traefik.v2.yaml" with :

```yaml
debug: false
accessLog: {}
log:
  level: DEBUG 

api: 
  insecure: true
  dashboard: true
  debug: true

entryPoints:
  web:
    address: ':80'
  web-secure:
    address: ':443'
tls:
 stores:
   default:
      defaultCertificate:
        certFile: /path/to/my/cert.pem
        keyFile: /path/to/my/privkey.pem

providers:
  file:
    watch: true
    filename: ./rules.yml
    debugLogGeneratedTemplate: true
  docker:
    endpoint: "unix:///var/run/docker.sock"

```

And my rules:

```yaml
http:
  routers:
    cloud:
      entryPoints:
        - 'web'
        - 'web-secure'
      rule: 'Host(`my.domain.tld`)'
      service: 'cloud'
      tls: {}
  services:
    cloud:
      loadBalancer:
        passHostHeader: true
        servers:
          - url: 'http://endpoint.tld/'

```

With this configuration the default TLS configuration is not set :

```auto
DEBU[2019-09-18T17:40:14+02:00] No default certificate, generating one                                                                                                                                                                      

```

But if I move the TLS section into my "rules.yaml" there is a default TLS.

Why should I set the default tls cert into the File provider?

Is it a bad configuration from my side?  
Any help to make me understand better would be appreciate 🙂

---

<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:** [September 18, 2019, 4:20pm UTC](https://community.traefik.io/t/default-tls-should-specificly-be-in-file-provider/1690/2 "2019-09-18T16:20:31Z")

</div>

> [@Aguay](#):
>
> ```auto
> tls:
> stores:
> default:
> defaultCertificate:
> certFile: /path/to/my/cert.pem
> keyFile: /path/to/my/privkey.pem
> 
> ```

the `tls` configuration must be placed in the dynamic configuration

- [File | Traefik | v2.0](https://docs.traefik.io/v2.0/reference/dynamic-configuration/file/)
- [TLS | Traefik | v2.0](https://docs.traefik.io/v2.0/https/tls/#user-defined)

Yes the only way to define the TLS section in the dynamic configuration is from the file provider.

---

<div class="post-metadata">

**Author:** ![Aguay](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Aguay](https://community.traefik.io/u/Aguay)\
**Post date:** [September 19, 2019, 7:14am UTC](https://community.traefik.io/t/default-tls-should-specificly-be-in-file-provider/1690/3 "2019-09-19T07:14:44Z")

</div>

Thanks for the quick reply.

It's kind of weird in my opinion but thanks for explanation 🙂
