Use ACME by default, but assign a custom wildcard certificate to one route

Hi there,

Today I switched from NPM to traefik and so far it seem to be very nice!
But I have one issue:
I want to use the automatic acme tlsChallange for most of my domains. But for one specifically I want to use a self created wildcart certificate. I would love to use automated let's encrypt here to create this wildcard certificate, but since the domain is from domains.google, which is not supported by the dnsChallange, I created a wildcard certificate myself using certbot. I then mounted the certificate into the docker container running traefik and added the following config to my main traefik.yml file:

tls:
  certificates:
    - certFile: /configurations/certs/*.my.domain.cert
      keyFile: /configurations/certs/*.my.domain.key

I'm using only the file provider (no docker) and now I want to assign these certificates to my service, that currently looks something like this:

http:
  routers:
    coder:
      service: coder
      entryPoints:
        - "https"
      rule: "HostRegexp(`my.domain.com`,`{subhost:[a-z]+}.my.domain.com`)"

  services:
    coder:
      loadBalancer:
        servers:
          - url: "http://<my-ip>"

How can I "assign" my custom certificates to this route/service?

I tried it with the tcp option for the routes element, but that did not work. Can somebody please guide me on how to do this? Thanks!

The TLS cert files need to be declared in a dynamic config file, which is loaded with provider.file in static config traefik.yml.

In the router enable tls: true for use of the custom cert.

Thanks for the hint!
I was able to solve this by using your mentioned tls option and add the certificates directly to this file like this:

tls:
  certificates:
    - certFile: /configurations/certs/*.my.domain.cert
      keyFile: /configurations/certs/*.my.domain.key

http:
  routers:
    coder:
      service: coder
      entryPoints:
        - "https"
      rule: "HostRegexp(`my.domain.com`,`{subhost:[a-z]+}.my.domain.com`)"
     tls: true

  services:
    coder:
      loadBalancer:
        servers:
          - url: "http://<my-ip>"

This works, loading a file with "*"?

Yes that works without any issue :+1:

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