Hi, I have a setup consisting of several docker containers that are accessed via traefik using https with let's encrypt. This setup is working perfectly. Here's the traefik.yml i'm using
Now I want to mantain the current setup but I want to add a service that has to be routed via an https using a private certificate (I have already created and it is saved in /certs folder). But I don't know how to configure the trefik.yml to add the certificate and select it for a specific something.mydomain.net
To use custom TLS/SSL certs, you can load them in the static config via provider.file from a dynamic config file. You don't need to add any host information in the tls section.
The previous labels are the ones I use with all the other services that run TLS with let's encrypt except for this line: - "traefik.http.routers.influxdb2-secure.tls.certresolver=http"
Which as I have understood from your message is the one that links the tls to the let's encrypt cert resolver.
If I spin up this and navigate to mocdb2.domain.net I'm warned that the certificate is not valid (which is good, because it means it is not using the let's encrypt one). However, when I look into the certificate details I see this:
Which means that traefik is using its default certificate and not the one I have set on the config.
What am I doing wrong? The other services that are suposed to be running with let's encrypt are working fine. So at least I have not broken something that previously worked
Wow, I didn't know that this could be done. When everything is working I will definetly try to do this.
Do you have an example docker-compose.yml file with the traefik labels necessary for it to work? Since the redirection to https is done on traefik.yml I supose there a lot less lines needed.
You can remove those, use redirect in entrypoints.
Check your Traefik log for error, if traefik-dynamic.yml and /certs/cert.crt are loaded correctly. Your cert.crt needs to include mockdb2.domain.net or be a wildcard cert.
Note: you should place acme.json on a fixed path and Docker-mount that as folder or volume. LE only allows 5 certificate re-creations per week for a domain name. So if you reset/restart you service often you might loose LE certs after 5 times.
PS: Why do you even want to use a custom cert? Just use a LE cert for this one, too.
Well, I didn't correctly configure the domain of the certificate. Now it is working.
And I needed to use a private certificate because I want to be the one on control of when it expires. This is because it will be used on an embedded device with limited connectivity.
Now I will try to tidy up my config using your recomendation of redirecting centrally in entrypoints. Thank you very much for everything, it has been very useful!!