Search code examples
traefik

Is it possible to have Traefik handle multiple certificates/ domains


My domain name jstock.co DNS, and SSL certificate are handled by Cloudflare.

I have the following traefik.toml

defaultEntryPoints = ["http", "https"]

[web]
address = ":8080"
  [web.auth.basic]
  users = ["admin:xxx"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
        CertFile = "/app/cert.pem"
        KeyFile = "/app/key.pem"

With the above setup, traefik able to re-route the following traffic to correct docker containers

  • https://notification.jstock.co/info/
  • https://iex.jstock.co/info/
  • https://intrinio.jstock.co/info/
  • ...

Now, we have purchased another domain name wenote.me. Its DNS, and SSL certificate also handled by Cloudflare.

I was wondering, is it possible, to reuse existing Traefik, to handle traffic from wenote.me? If so, what should be traefik.toml looks like?


Solution

  • This is how it is being done.

    defaultEntryPoints = ["http", "https"]
    
    [web]
    address = ":8080"
      [web.auth.basic]
      users = ["admin:xxx"]
    
    [entryPoints]
      [entryPoints.http]
      address = ":80"
        [entryPoints.http.redirect]
          entryPoint = "https"
      [entryPoints.https]
      address = ":443"
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
            CertFile = "/app/cert.pem"
            KeyFile = "/app/key.pem"
          [[entryPoints.https.tls.certificates]]
            CertFile = "/app/wenote.me.cert.pem"
            KeyFile = "/app/wenote.me.key.pem"