Let’s Encrypt

    You can configure Traefik to use an ACME provider (like Let’s Encrypt) for automatic certificate generation.

    Let’s Encrypt and Rate Limiting

    Note that Let’s Encrypt API has rate limiting. These last up to one week, and can not be overridden.

    When running Traefik in a container this file should be persisted across restarts. If Traefik requests new certificates each time it starts up, a crash-looping container can quickly reach Let’s Encrypt’s ratelimits. To configure where certificates are stored, please take a look at the configuration.

    Use Let’s Encrypt staging server with the caServer configuration option when experimenting to avoid hitting this limit too fast.

    Traefik requires you to define “Certificate Resolvers” in the static configuration, which are responsible for retrieving certificates from an ACME server.

    Then, each is configured to enable TLS, and is associated to a certificate resolver through the tls.certresolver configuration option.

    Certificates are requested for domain names retrieved from the router’s .

    You can read more about this retrieval mechanism in the following section: ACME Domain Definition.

    Defining an is a requirement for a certificate resolver to be functional.

    Defining a certificate resolver does not result in all routers automatically using it. Each router that is supposed to use the resolver must reference it.

    Configuration Reference

    There are many available options for ACME. For a quick glance at what’s possible, browse the configuration reference:

    File (YAML)

    File (TOML)

    1. # Enable ACME (Let's Encrypt): automatic SSL.
    2. [certificatesResolvers.myresolver.acme]
    3. # Email address used for registration.
    4. #
    5. # Required
    6. #
    7. email = "[email protected]"
    8. # File or key used for certificates storage.
    9. #
    10. # Required
    11. #
    12. storage = "acme.json"
    13. # CA server to use.
    14. # Uncomment the line to use Let's Encrypt's staging server,
    15. # leave commented to go to prod.
    16. #
    17. # Optional
    18. # Default: "https://acme-v02.api.letsencrypt.org/directory"
    19. #
    20. # caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
    21. # The certificates' duration in hours.
    22. # It defaults to 2160 (90 days) to follow Let's Encrypt certificates' duration.
    23. #
    24. # Optional
    25. # Default: 2160
    26. #
    27. # certificatesDuration=2160
    28. # Preferred chain to use.
    29. #
    30. # If the CA offers multiple certificate chains, prefer the chain with an issuer matching this Subject Common Name.
    31. # If no match, the default offered chain will be used.
    32. #
    33. # Optional
    34. # Default: ""
    35. #
    36. # preferredChain = "ISRG Root X1"
    37. # KeyType to use.
    38. #
    39. # Optional
    40. # Default: "RSA4096"
    41. #
    42. # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192"
    43. #
    44. # keyType = "RSA4096"
    45. # Use a TLS-ALPN-01 ACME challenge.
    46. #
    47. # Optional (but recommended)
    48. #
    49. [certificatesResolvers.myresolver.acme.tlsChallenge]
    50. # Use a HTTP-01 ACME challenge.
    51. #
    52. # Optional
    53. #
    54. # [certificatesResolvers.myresolver.acme.httpChallenge]
    55. # EntryPoint to use for the HTTP-01 challenges.
    56. #
    57. # Required
    58. #
    59. # entryPoint = "web"
    60. # Use a DNS-01 ACME challenge rather than HTTP-01 challenge.
    61. # Note: mandatory for wildcard certificate generation.
    62. #
    63. # Optional
    64. #
    65. # [certificatesResolvers.myresolver.acme.dnsChallenge]
    66. # DNS provider used.
    67. #
    68. # Required
    69. #
    70. # provider = "digitalocean"
    71. # By default, the provider will verify the TXT DNS challenge record before letting ACME verify.
    72. # If delayBeforeCheck is greater than zero, this check is delayed for the configured duration in seconds.
    73. # Useful if internal networks block external DNS queries.
    74. #
    75. # Optional
    76. # Default: 0
    77. #
    78. # delayBeforeCheck = 0
    79. # Use following DNS servers to resolve the FQDN authority.
    80. #
    81. # Optional
    82. # Default: empty
    83. #
    84. # resolvers = ["1.1.1.1:53", "8.8.8.8:53"]
    85. # Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready.
    86. #
    87. # NOT RECOMMENDED:
    88. # Increase the risk of reaching Let's Encrypt's rate limits.
    89. #
    90. # Optional
    91. # Default: false
    92. #
    93. # disablePropagationCheck = true

    CLI

    1. # Enable ACME (Let's Encrypt): automatic SSL.
    2. # Email address used for registration.
    3. #
    4. # Required
    5. #
    6. [email protected]
    7. # File or key used for certificates storage.
    8. #
    9. # Required
    10. #
    11. --certificatesresolvers.myresolver.acme.storage=acme.json
    12. # CA server to use.
    13. # Uncomment the line to use Let's Encrypt's staging server,
    14. # leave commented to go to prod.
    15. #
    16. # Optional
    17. # Default: "https://acme-v02.api.letsencrypt.org/directory"
    18. #
    19. --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
    20. # The certificates' duration in hours.
    21. # It defaults to 2160 (90 days) to follow Let's Encrypt certificates' duration.
    22. #
    23. # Optional
    24. # Default: 2160
    25. #
    26. --certificatesresolvers.myresolver.acme.certificatesDuration=2160
    27. # Preferred chain to use.
    28. #
    29. # If the CA offers multiple certificate chains, prefer the chain with an issuer matching this Subject Common Name.
    30. # If no match, the default offered chain will be used.
    31. #
    32. # Optional
    33. # Default: ""
    34. #
    35. --certificatesresolvers.myresolver.acme.preferredchain="ISRG Root X1"
    36. # KeyType to use.
    37. #
    38. # Optional
    39. # Default: "RSA4096"
    40. #
    41. # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192"
    42. #
    43. --certificatesresolvers.myresolver.acme.keytype=RSA4096
    44. # Use a TLS-ALPN-01 ACME challenge.
    45. #
    46. # Optional (but recommended)
    47. #
    48. --certificatesresolvers.myresolver.acme.tlschallenge=true
    49. # Use a HTTP-01 ACME challenge.
    50. #
    51. # Optional
    52. #
    53. --certificatesresolvers.myresolver.acme.httpchallenge=true
    54. # EntryPoint to use for the HTTP-01 challenges.
    55. #
    56. # Required
    57. #
    58. --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
    59. # Use a DNS-01 ACME challenge rather than HTTP-01 challenge.
    60. # Note: mandatory for wildcard certificate generation.
    61. #
    62. # Optional
    63. #
    64. --certificatesresolvers.myresolver.acme.dnschallenge=true
    65. # DNS provider used.
    66. #
    67. # Required
    68. #
    69. --certificatesresolvers.myresolver.acme.dnschallenge.provider=digitalocean
    70. # By default, the provider will verify the TXT DNS challenge record before letting ACME verify.
    71. # If delayBeforeCheck is greater than zero, this check is delayed for the configured duration in seconds.
    72. # Useful if internal networks block external DNS queries.
    73. #
    74. # Optional
    75. # Default: 0
    76. #
    77. --certificatesresolvers.myresolver.acme.dnschallenge.delaybeforecheck=0
    78. # Use following DNS servers to resolve the FQDN authority.
    79. #
    80. # Optional
    81. # Default: empty
    82. #
    83. --certificatesresolvers.myresolver.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53
    84. # Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready.
    85. #
    86. # NOT RECOMMENDED:
    87. # Increase the risk of reaching Let's Encrypt's rate limits.
    88. #
    89. # Optional
    90. # Default: false
    91. #
    92. --certificatesresolvers.myresolver.acme.dnschallenge.disablepropagationcheck=true

    Domain Definition

    Certificate resolvers request certificates for a set of the domain names inferred from routers, with the following logic:

    • If the router has a tls.domains option set, then the certificate resolver uses the main (and optionally sans) option of tls.domains to know the domain names for this router.

    • If no option is set, then the certificate resolver uses the router’s rule, by checking the Host() matchers. Please note that ) for specifying multiple domain names for this router.

    Please note that:

    • When multiple domain names are inferred from a given router, only one certificate is requested with the first domain name as the main domain, and the other domains as “SANs” (Subject Alternative Name).

    • As , any router can provide a wildcard domain name, as “main” domain or as “SAN” domain.

    Please check the for more details.

    Configuration Examples

    Enabling ACME

    File (YAML)

    1. entryPoints:
    2. web:
    3. address: ":80"
    4. websecure:
    5. address: ":443"
    6. certificatesResolvers:
    7. myresolver:
    8. acme:
    9. email: [email protected]
    10. storage: acme.json
    11. httpChallenge:
    12. # used during the challenge
    13. entryPoint: web

    File (TOML)

    1. [entryPoints]
    2. [entryPoints.web]
    3. address = ":80"
    4. [entryPoints.websecure]
    5. address = ":443"
    6. [certificatesResolvers.myresolver.acme]
    7. email = "[email protected]"
    8. storage = "acme.json"
    9. [certificatesResolvers.myresolver.acme.httpChallenge]
    10. # used during the challenge
    11. entryPoint = "web"

    CLI

    1. --entrypoints.web.address=:80
    2. --entrypoints.websecure.address=:443
    3. # ...
    4. [email protected].com
    5. --certificatesresolvers.myresolver.acme.storage=acme.json
    6. # used during the challenge
    7. --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web

    Defining a certificate resolver does not result in all routers automatically using it. Each router that is supposed to use the resolver must it.

    Single Domain from Router’s Rule Example

    • A certificate for the domain example.com is requested:

    Docker

    1. ## Dynamic configuration
    2. labels:
    3. - traefik.http.routers.blog.rule=Host(`example.com`) && Path(`/blog`)
    4. - traefik.http.routers.blog.tls=true
    5. - traefik.http.routers.blog.tls.certresolver=myresolver

    Docker (Swarm)

    1. ## Dynamic configuration
    2. deploy:
    3. labels:
    4. - traefik.http.routers.blog.rule=Host(`example.com`) && Path(`/blog`)
    5. - traefik.http.routers.blog.tls=true
    6. - traefik.http.routers.blog.tls.certresolver=myresolver
    7. - traefik.http.services.blog-svc.loadbalancer.server.port=8080"

    Kubernetes

    1. apiVersion: traefik.io/v1alpha1
    2. kind: IngressRoute
    3. metadata:
    4. name: blogtls
    5. spec:
    6. entryPoints:
    7. - websecure
    8. routes:
    9. - match: Host(`example.com`) && Path(`/blog`)
    10. kind: Rule
    11. services:
    12. - name: blog
    13. port: 8080
    14. tls:
    15. certResolver: myresolver

    Marathon

    1. labels: {
    2. "traefik.http.routers.blog.rule": "Host(`example.com`) && Path(`/blog`)",
    3. "traefik.http.routers.blog.tls": "true",
    4. "traefik.http.routers.blog.tls.certresolver": "myresolver",
    5. "traefik.http.services.blog-svc.loadbalancer.server.port": "8080"
    6. }

    Rancher

    1. ## Dynamic configuration
    2. labels:
    3. - traefik.http.routers.blog.rule=Host(`example.com`) && Path(`/blog`)
    4. - traefik.http.routers.blog.tls=true
    5. - traefik.http.routers.blog.tls.certresolver=myresolver

    File (YAML)

    1. ## Dynamic configuration
    2. http:
    3. routers:
    4. blog:
    5. rule: "Host(`example.com`) && Path(`/blog`)"
    6. tls:
    7. certResolver: myresolver

    File (TOML)

    1. ## Dynamic configuration
    2. [http.routers]
    3. [http.routers.blog]
    4. rule = "Host(`example.com`) && Path(`/blog`)"
    5. [http.routers.blog.tls]
    6. certResolver = "myresolver"

    Multiple Domains from Router’s Rule Example

    • A certificate for the domains example.com (main) and blog.example.org is requested:

    Docker

    1. ## Dynamic configuration
    2. labels:
    3. - traefik.http.routers.blog.rule=(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)
    4. - traefik.http.routers.blog.tls=true
    5. - traefik.http.routers.blog.tls.certresolver=myresolver

    Docker (Swarm)

    1. ## Dynamic configuration
    2. deploy:
    3. labels:
    4. - traefik.http.routers.blog.rule=(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)
    5. - traefik.http.routers.blog.tls=true
    6. - traefik.http.routers.blog.tls.certresolver=myresolver
    7. - traefik.http.services.blog-svc.loadbalancer.server.port=8080"

    Kubernetes

    1. apiVersion: traefik.io/v1alpha1
    2. metadata:
    3. name: blogtls
    4. spec:
    5. entryPoints:
    6. - websecure
    7. routes:
    8. - match: (Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)
    9. kind: Rule
    10. services:
    11. - name: blog
    12. port: 8080
    13. tls:
    14. certResolver: myresolver

    Marathon

    1. labels: {
    2. "traefik.http.routers.blog.rule": "(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)",
    3. "traefik.http.routers.blog.tls": "true",
    4. "traefik.http.routers.blog.tls.certresolver": "myresolver",
    5. "traefik.http.services.blog-svc.loadbalancer.server.port": "8080"
    6. }

    Rancher

    1. ## Dynamic configuration
    2. labels:
    3. - traefik.http.routers.blog.rule=(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)
    4. - traefik.http.routers.blog.tls=true
    5. - traefik.http.routers.blog.tls.certresolver=myresolver

    File (YAML)

    1. ## Dynamic configuration
    2. http:
    3. routers:
    4. blog:
    5. rule: "(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)"
    6. tls:
    7. certResolver: myresolver

    File (TOML)

    1. ## Dynamic configuration
    2. [http.routers]
    3. [http.routers.blog]
    4. rule = "(Host(`example.com`) && Path(`/blog`)) || Host(`blog.example.org`)"
    5. [http.routers.blog.tls]
    6. certResolver = "myresolver"

    Multiple Domains from Router’s tls.domain Example

    • A certificate for the domains example.com (main) and *.example.org (SAN) is requested:

    Docker

    1. ## Dynamic configuration
    2. deploy:
    3. labels:
    4. - traefik.http.routers.blog.rule=Host(`example.com`) && Path(`/blog`)
    5. - traefik.http.services.blog-svc.loadbalancer.server.port=8080"
    6. - traefik.http.routers.blog.tls=true
    7. - traefik.http.routers.blog.tls.certresolver=myresolver
    8. - traefik.http.routers.blog.tls.domains[0].main=example.org
    9. - traefik.http.routers.blog.tls.domains[0].sans=*.example.org

    Kubernetes

    1. apiVersion: traefik.io/v1alpha1
    2. kind: IngressRoute
    3. metadata:
    4. name: blogtls
    5. spec:
    6. entryPoints:
    7. - websecure
    8. routes:
    9. - match: Host(`example.com`) && Path(`/blog`)
    10. kind: Rule
    11. services:
    12. - name: blog
    13. port: 8080
    14. tls:
    15. certResolver: myresolver
    16. domains:
    17. - main: example.org
    18. - '*.example.org'

    Marathon

    1. labels: {
    2. "traefik.http.routers.blog.rule": "Host(`example.com`) && Path(`/blog`)",
    3. "traefik.http.routers.blog.tls": "true",
    4. "traefik.http.routers.blog.tls.certresolver": "myresolver",
    5. "traefik.http.routers.blog.tls.domains[0].main": "example.com",
    6. "traefik.http.routers.blog.tls.domains[0].sans": "*.example.com",
    7. "traefik.http.services.blog-svc.loadbalancer.server.port": "8080"
    8. }

    Rancher

    1. ## Dynamic configuration
    2. labels:
    3. - traefik.http.routers.blog.rule=Host(`example.com`) && Path(`/blog`)
    4. - traefik.http.routers.blog.tls=true
    5. - traefik.http.routers.blog.tls.certresolver=myresolver
    6. - traefik.http.routers.blog.tls.domains[0].main=example.org
    7. - traefik.http.routers.blog.tls.domains[0].sans=*.example.org

    File (YAML)

    1. ## Dynamic configuration
    2. http:
    3. routers:
    4. blog:
    5. rule: "Host(`example.com`) && Path(`/blog`)"
    6. tls:
    7. certResolver: myresolver
    8. domains:
    9. - main: "example.org"
    10. sans:
    11. - "*.example.org"

    File (TOML)

    1. ## Dynamic configuration
    2. [http.routers]
    3. [http.routers.blog]
    4. rule = "Host(`example.com`) && Path(`/blog`)"
    5. [http.routers.blog.tls]
    6. certResolver = "myresolver" # From static configuration
    7. [[http.routers.blog.tls.domains]]
    8. main = "example.org"
    9. sans = ["*.example.org"]

    Traefik automatically tracks the expiry date of ACME certificates it generates.

    By default, Traefik manages 90 days certificates, and starts to renew certificates 30 days before their expiry.

    When using a certificate resolver that issues certificates with custom durations, one can configure the certificates’ duration with the option.

    Certificates that are no longer used may still be renewed, as Traefik does not currently check if the certificate is being used before renewing.

    Using LetsEncrypt with Kubernetes

    When using LetsEncrypt with kubernetes, there are some known caveats with both the and crd providers.

    If you intend to run multiple instances of Traefik with LetsEncrypt, please ensure you read the sections on those provider pages.

    The Different ACME Challenges

    Defining one ACME challenge is a requirement for a certificate resolver to be functional.

    Defining a certificate resolver does not result in all routers automatically using it. Each router that is supposed to use the resolver must reference it.

    Use the TLS-ALPN-01 challenge to generate and renew ACME certificates by provisioning a TLS certificate.

    As described on the Let’s Encrypt community forum, when using the TLS-ALPN-01 challenge, Traefik must be reachable by Let’s Encrypt through port 443.

    Configuring the tlsChallenge

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. tlsChallenge: {}

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. [certificatesResolvers.myresolver.acme.tlsChallenge]

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.tlschallenge=true

    httpChallenge

    Use the HTTP-01 challenge to generate and renew ACME certificates by provisioning an HTTP resource under a well-known URI.

    As described on the Let’s Encrypt community forum, when using the HTTP-01 challenge, certificatesresolvers.myresolver.acme.httpchallenge.entrypoint must be reachable by Let’s Encrypt through port 80.

    Using an EntryPoint Called web for the httpChallenge

    File (YAML)

    1. entryPoints:
    2. web:
    3. address: ":80"
    4. websecure:
    5. address: ":443"
    6. certificatesResolvers:
    7. myresolver:
    8. acme:
    9. # ...
    10. httpChallenge:
    11. entryPoint: web

    File (TOML)

    1. [entryPoints]
    2. [entryPoints.web]
    3. address = ":80"
    4. [entryPoints.websecure]
    5. address = ":443"
    6. [certificatesResolvers.myresolver.acme]
    7. # ...
    8. [certificatesResolvers.myresolver.acme.httpChallenge]
    9. entryPoint = "web"

    CLI

    1. --entrypoints.web.address=:80
    2. --entrypoints.websecure.address=:443
    3. # ...
    4. --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web

    Redirection is fully compatible with the HTTP-01 challenge.

    Use the DNS-01 challenge to generate and renew ACME certificates by provisioning a DNS record.

    Configuring a dnsChallenge with the DigitalOcean Provider

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. dnsChallenge:
    6. provider: digitalocean
    7. delayBeforeCheck: 0
    8. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. [certificatesResolvers.myresolver.acme.dnsChallenge]
    4. provider = "digitalocean"
    5. delayBeforeCheck = 0
    6. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.dnschallenge.provider=digitalocean
    3. --certificatesresolvers.myresolver.acme.dnschallenge.delaybeforecheck=0
    4. # ...

    CNAME support

    CNAME are supported (and sometimes even encouraged), but there are a few cases where they can be .

    If needed, CNAME support can be disabled with the following environment variable:

    1. LEGO_DISABLE_CNAME_SUPPORT=true

    Important

    A provider is mandatory.

    providers

    Here is a list of supported providers, that can automate the DNS verification, along with the required environment variables and their . Do not hesitate to complete it.

    Many lego environment variables can be overridden by their respective _FILE counterpart, which should have a filepath to a file that contains the secret as its value. For example, CF_API_EMAIL_FILE=/run/secrets/traefik_cf-api-email could be used to provide a Cloudflare API email address as a Docker secret named traefik_cf-api-email.

    For complete details, refer to your provider’s Additional configuration link.

    delayBeforeCheck

    By default, the provider verifies the TXT record before letting ACME verify. You can delay this operation by specifying a delay (in seconds) with delayBeforeCheck (value must be greater than zero). This option is useful when internal networks block external DNS queries.

    resolvers

    Use custom DNS servers to resolve the FQDN authority.

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. dnsChallenge:
    6. # ...
    7. resolvers:
    8. - "1.1.1.1:53"
    9. - "8.8.8.8:53"

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. [certificatesResolvers.myresolver.acme.dnsChallenge]
    4. # ...
    5. resolvers = ["1.1.1.1:53", "8.8.8.8:53"]

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53

    Wildcard Domains

    ACME V2 supports wildcard certificates. As described in wildcard certificates can only be generated through a DNS-01 challenge.

    • kid: Key identifier from External CA
    • hmacEncoded: HMAC key from External CA, should be in Base64 URL Encoding without padding format

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. [certificatesResolvers.myresolver.acme.eab]
    4. kid = "abc-keyID-xyz"
    5. hmacEncoded = "abc-hmac-xyz"

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.eab.kid=abc-keyID-xyz
    3. --certificatesresolvers.myresolver.acme.eab.hmacencoded=abc-hmac-xyz

    More Configuration

    caServer

    Required, Default=”https://acme-v02.api.letsencrypt.org/directory

    The CA server to use:

    Using the Let’s Encrypt staging server

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. caServer: https://acme-staging-v02.api.letsencrypt.org/directory
    6. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
    4. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
    3. # ...

    Required, Default=”acme.json”

    The storage option sets the location where your ACME certificates are saved to.

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. storage: acme.json
    6. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. storage = "acme.json"
    4. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.storage=acme.json
    3. # ...

    ACME certificates are stored in a JSON file that needs to have a 600 file mode.

    In Docker you can mount either the JSON file, or the folder containing it:

    1. docker run -v "/my/host/acme.json:/acme.json" traefik
    1. docker run -v "/my/host/acme:/etc/traefik/acme" traefik

    Warning

    For concurrency reasons, this file cannot be shared across multiple instances of Traefik.

    certificatesDuration

    Optional, Default=2160

    The certificatesDuration option defines the certificates’ duration in hours. It defaults to 2160 (90 days) to follow Let’s Encrypt certificates’ duration.

    Traefik cannot manage certificates with a duration lower than 1 hour.

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. certificatesDuration: 72
    6. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. certificatesDuration=72
    4. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.certificatesduration=72
    3. # ...

    certificatesDuration is used to calculate two durations:

    • Renew Period: the period before the end of the certificate duration, during which the certificate should be renewed.
    • Renew Interval: the interval between renew attempts.
    Certificate DurationRenew PeriodRenew Interval
    >= 1 year4 months1 week
    >= 90 days30 days1 day
    >= 7 days1 day1 hour
    >= 24 hours6 hours10 min
    < 24 hours20 min1 min

    Optional, Default=””

    Preferred chain to use.

    If the CA offers multiple certificate chains, prefer the chain with an issuer matching this Subject Common Name. If no match, the default offered chain will be used.

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. preferredChain: 'ISRG Root X1'
    6. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. preferredChain = "ISRG Root X1"
    4. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.preferredChain=ISRG Root X1
    3. # ...

    keyType

    Optional, Default=”RSA4096”

    KeyType used for generating certificate private key. Allow value ‘EC256’, ‘EC384’, ‘RSA2048’, ‘RSA4096’, ‘RSA8192’.

    File (YAML)

    1. certificatesResolvers:
    2. myresolver:
    3. acme:
    4. # ...
    5. keyType: 'RSA4096'
    6. # ...

    File (TOML)

    1. [certificatesResolvers.myresolver.acme]
    2. # ...
    3. keyType = "RSA4096"
    4. # ...

    CLI

    1. # ...
    2. --certificatesresolvers.myresolver.acme.keyType=RSA4096
    3. # ...

    Fallback

    If Let’s Encrypt is not reachable, the following certificates will apply:

    1. Previously generated ACME certificates (before downtime)
    2. Expired ACME certificates
    3. Provided certificates

    Important

    For new (sub)domains which need Let’s Encrypt authentication, the default Traefik certificate will be used until Traefik is restarted.


    Using Traefik for Business Applications?

    If you are using Traefik in your organization, consider Traefik Enterprise. You can use it as your:

    Traefik Enterprise simplifies the discovery, security, and deployment of APIs and microservices across any environment. See it in action in this short video walkthrough.


    1. More information about the HTTP message format can be found .

    2. .

    3. docker stack remark: there is no way to support terminal attached to container when deploying with docker stack, so you might need to run container with docker run -it to generate certificates using manual provider.

    4. The Global API Key needs to be used, not the .