# Using certresolver over default stored certificate

**URL:** <https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030>\
**Category:** Traefik v2\
**Tags:** letsencrypt-acme\
**Created:** [October 5, 2022, 11:32am UTC](https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030 "2022-10-05T11:32:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nielsvg2001](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nielsvg2001/32/6002_2.png) [@Nielsvg2001](https://community.traefik.io/u/Nielsvg2001)\
**Post date:** [October 5, 2022, 11:32am UTC](https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030/1 "2022-10-05T11:32:18Z")

</div>

Hey,

I have set a default certificate with the following method in my traefik.yml.

```auto
tls:
  stores:
    default:
      defaultCertificate:
        certFile: path/to/cert.crt
        keyFile: path/to/cert.key

```

Now I want to overwrite this certificate for some domains. So I tried this in my config.yml file.

```auto
http:
  #region routers
  routers:
    plex:
      entryPoints:
        - web
        - websecure
      rule: "Host(`plex.example.tk`)"
      middlewares:
        - authelia
      tls:
        certResolver: staging
      service: plex

```

Still, the default certificate is used. When the default certificate section is commented, it switches to my certresolver.

Any idea to make them both work?

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [October 6, 2022, 9:40am UTC](https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030/2 "2022-10-06T09:40:45Z")

</div>

Works for me, we have custom TLS and some services using LetsEncrypt.

You need to define the `certificatesResolvers` in your static config (like `providers` and `entrypoints`), and put both TLS and HTTP into a dynamic configuration. Dynamic config files can be loaded with [provider.file](https://doc.traefik.io/traefik/providers/file/) in the static config.

A good idea is always to enable Traefik [debug logging](https://doc.traefik.io/traefik/observability/logs/) and check the log file for errors.

---

<div class="post-metadata">

**Author:** ![Nielsvg2001](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nielsvg2001/32/6002_2.png) [@Nielsvg2001](https://community.traefik.io/u/Nielsvg2001)\
**Post date:** [October 6, 2022, 4:02pm UTC](https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030/3 "2022-10-06T16:02:09Z")

</div>

Thanks for the response.

I had placed my defaultCertificate in the static config. After moving this to the dynamic one everything works!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [October 9, 2022, 4:02pm UTC](https://community.traefik.io/t/using-certresolver-over-default-stored-certificate/16030/4 "2022-10-09T16:02:19Z")

</div>

Closed on October 9, 2022, 4:02pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
