Traefik Let's Encrypt SSL Challenge Failed: ACME Fixes

18 min readBy Yun Sanghun (M. Yun)

A Traefik "SSL challenge failed" problem means either the ACME server could not validate your domain over the network, or Traefik never got as far as asking because it rejected your local certificate storage file at startup. Before debugging firewall rules, port forwarding, or Cloudflare DNS tokens, check the permissions on acme.json first. When Traefik starts with an acme.json file whose mode is wider than 600 (such as the default 0644 created by standard Linux umask 022 or 0777 on a Windows bind mount), it drops the entire certificate resolver immediately and logs a startup error while continuing to run and serve its self-signed default certificate.

Here is that exact check reproduced on Traefik v3.1 (3.1.7, Docker Desktop on Windows 11, WSL 2 backend, Docker Engine 27.3.1) on 2025-01-31. The same ACME resolver was started twice via /lab/traefik_acme.sh, first with /le/acme.json set to 644 (-rw-r--r--), and then set to 600 (-rw-------):

Traefik v3.1 acme.json at 644 too open vs 600 startup log comparison
At 644 (-rw-r--r--), Traefik drops the certificate resolver at startup with permissions 644 for /letsencrypt/acme.json are too open, please use 600; at 600 (-rw-------), the identical startup logs zero ACME permission errors while keeping the proxy running.
Traefik v3 Let's Encrypt ACME topology comparing acme.json 0644 permission errors and blocked port 80 HTTP-01 challenges serving TRAEFIK DEFAULT CERT against chmod 600 and Cloudflare DNS-01 TXT validation
Traefik v3 ACME Issuance Paths: Fixing chmod 600 acme.json and switching from port-80 httpChallenge to Cloudflare dnsChallenge with a zone-scoped CF_DNS_API_TOKEN issues wildcard certificates cleanly behind CGNAT, ISP port blocks, or Orange-Cloud DNS.

Short Answer (Quick Fix): If Traefik logs permissions 644 (or 777) for /letsencrypt/acme.json are too open, please use 600, lock the file to chmod 600 ./letsencrypt/acme.json (or create it inside a container or Docker named volume on Windows). If your permissions are already 600 but Traefik logs urn:ietf:params:acme:error:connection on port 80 because of ISP port blocking, CGNAT, or Cloudflare proxying, switch from HTTP-01 to the Cloudflare DNS-01 challenge using a scoped CF_DNS_API_TOKEN so Traefik validates domain ownership via DNS TXT records without requiring inbound port 80.

What Fails When Traefik Cannot Complete the ACME Challenge

When deploying Traefik reverse proxy to front self-hosted Docker services (n8n, Nextcloud, Home Assistant, Vaultwarden), many setups start with the HTTP-01 challenge. Traefik itself has no default challenge enabled: a certificate resolver only works once you explicitly configure httpChallenge, tlsChallenge, or dnsChallenge (Traefik ACME docs).

When certificate issuance or loading fails, Traefik does not crash or stop listening on port 443. Instead, it keeps serving HTTPS using its built-in self-signed fallback certificate. In my port-80-closed test below, inspecting the live TLS handshake with openssl s_client -servername app.gfl.test returned subject=CN=TRAEFIK DEFAULT CERT and issuer=CN=TRAEFIK DEFAULT CERT:

openssl s_client comparison of CN=TRAEFIK DEFAULT CERT fallback versus ACME-issued CA certificate
Inspecting the live TLS handshake on port 443 with openssl s_client -servername app.gfl.test: when acme.json is skipped or HTTP-01 fails, Traefik silently falls back to its self-signed CN=TRAEFIK DEFAULT CERT (left) instead of serving the ACME-issued certificate stored in acme.json (right).

Why HTTP-01 Fails: The Root Causes

  1. Carrier-Grade NAT (CGNAT): Many residential fiber, cable, and 5G/LTE ISPs share a single public IPv4 address across dozens of subscriber routers. Inbound validation requests from Let's Encrypt on TCP port 80 terminate at the carrier edge and never reach your home lab router.
  2. ISP Port 80 Filtering: Even when you have a dedicated public IPv4 address, consumer broadband providers frequently filter inbound TCP port 80 to block residential web servers. Because the ACME HTTP-01 specification strictly hardcodes port 80 for initial token fetches, remapping your router or moving Traefik's web entrypoint to another port such as 8080 or 8081 does not work (see the empirical Pebble measurement below).
  3. Cloudflare Orange-Cloud Proxying: With the Cloudflare proxy enabled (orange cloud), Let's Encrypt's request for http://yourdomain.com/.well-known/acme-challenge/<token> hits Cloudflare's edge first. Universal SSL redirects, "Always Use HTTPS" rules, or Bot Fight Mode can intercept or alter the challenge response before it reaches Traefik.
  4. File Permissions on acme.json: Traefik refuses to load or register an ACME resolver if acme.json permissions are broader than 600 (reproduced at the top of this post).

Measured: HTTP-01 With Port 80 Open and Closed (Pebble, Not Let's Encrypt)

Let's Encrypt only performs the HTTP-01 challenge on TCP port 80 (Let's Encrypt challenge types), and Traefik's documentation states that the httpChallenge entrypoint must be reachable through port 80. To measure what happens when it is not, on 2025-01-31 I ran Traefik 3.1.7 (traefik:v3.1, Codename comte, go1.23.2) against Pebble, Let's Encrypt's ACME test server, on an isolated Docker network on Docker Desktop (Windows 11):

Traefik 3.1.7 HTTP-01 test against Pebble with port 80 open versus closed on port 8081
Raw log output from our Traefik 3.1.7 HTTP-01 test against Pebble: with the web entrypoint listening on port 80 (case 1), Pebble validates the token and issues a certificate in 5 seconds (issuer=CN=Pebble Intermediate CA 7f0e26); with the web entrypoint moved to port 8081 (case 2), validation fails after 27 seconds with urn:ietf:params:acme:error:connection and Traefik serves CN=TRAEFIK DEFAULT CERT.

Pebble is designed specifically for ACME protocol testing and its root and intermediate CAs are not in any public browser trust store, so this experiment measures the exact challenge state machine rather than a publicly trusted production certificate. In our testbed, I overrode Pebble's default HTTP validation port from 5002 to 80 ("httpPort": 80) and passed Pebble's root certificate to Traefik so the ACME client trusted Pebble's HTTPS directory at https://0.0.0.0:14000/dir.

  • Port 80 open (--entrypoints.web.address=:80): The issued certificate was written into /letsencrypt/acme.json just 5 s after container startup, Pebble logged authz 7Wz-IaNGd37jisRtDcDh8iL7A7T_YZQDU-0L90_M2Vo set VALID by completed challenge, and running openssl s_client -servername app.gfl.test from a client container returned issuer=CN=Pebble Intermediate CA 7f0e26.
  • Inside Traefik's HTTP router table (/dashboard/#/http/routers and /api/http/routers), Traefik automatically wires an internal high-priority router named acme-http@internal matching PathPrefix(`/.well-known/acme-challenge/`) onto the web entrypoint alongside our application router app@docker matching Host(`app.gfl.test`) on websecure (:443):
Traefik v3.1.7 HTTP Routers dashboard showing app@docker and acme-http@internal routers
Inspecting the live Traefik HTTP Routers dashboard (/dashboard/#/http/routers) and /api/http/routers endpoint during the Pebble test: Traefik binds the internal acme-http@internal challenge router to the web entrypoint (:80) while attaching the le certificate resolver to Host("app.gfl.test") on websecure (:443).
  • Port 80 closed (--entrypoints.web.address=:8081): No certificate was stored in acme.json after 27 s. Traefik logged ERR Unable to obtain ACME certificate for domains with acme: error: 400 :: urn:ietf:params:acme:error:connection :: Get "http://app.gfl.test:80/.well-known/acme-challenge/Zgn_d7lqWxNSa0bOM2IFBwGcfxwydEZRf8K5PnsFp1..." (truncated at 400 characters by our log filter). Pebble logged Starting 3 validations, marked both the authorization (fBX9TIeIDYODkz-eiXWdlAPPvCDJ4neuWJoJnwRAXRg) and the order (YnnHGJp-zD04yxDuxfXUI8c0ZpvayW7n3-iYn2qxZS8) as INVALID, and Traefik served subject=CN=TRAEFIK DEFAULT CERT / issuer=CN=TRAEFIK DEFAULT CERT instead.
  • In both Case 1 and Case 2, /letsencrypt/acme.json lived inside a fresh Docker named volume rather than a host bind mount, and Traefik created the file itself. It came out with mode -rw------- (600) both times.

To make this test reproducible on any Docker host without hitting Let's Encrypt's production rate limits, here are the exact pebble-config.json file and the run_pebble_http01_test.sh harness script used to execute Case 1 (:80) and Case 2 (:8081):

Pebble pebble-config.json with httpPort 80 and run_pebble_http01_test.sh harness script
Exact Pebble test configuration pebble-config.json (left, setting httpPort: 80 instead of Pebble's default 5002) and our Docker test harness script run_pebble_http01_test.sh (right) comparing --entrypoints.web.address=:80 against --entrypoints.web.address=:8081.

Comparing the two runs side by side highlights why port remapping never rescues a blocked HTTP-01 deployment. When you change --entrypoints.web.address=:80 to :8081 (or map host port 8080:80 in Docker Compose because your ISP blocks port 80 or another daemon occupies it), Traefik moves its acme-http@internal listener to port 8081, leaving TCP port 80 closed. However, RFC 8555 Section 8.3 mandates that the ACME Validation Authority initiate HTTP-01 token verification over standard TCP port 80 (http://app.gfl.test:80/.well-known/acme-challenge/<token>).

As shown in Pebble's validation trace below, when port 80 is reachable in Case 1, a single HTTP GET completes the challenge in 5 seconds. When port 80 is closed in Case 2, Pebble attempts 3 validations against port 80 across a 27-second window before marking the authorization and order INVALID and returning urn:ietf:params:acme:error:connection to Traefik:

Side-by-side Pebble HTTP-01 validation trace for port 80 open versus port 8081 closed
Side-by-side breakdown of Case 1 (port 80 open, left) versus Case 2 (web entrypoint moved to port 8081 while port 80 is closed, right): because ACME HTTP-01 strictly dials TCP port 80, moving Traefik's web entrypoint to another port still results in urn:ietf:params:acme:error:connection after three failed validation attempts (27 seconds).

Fixes I Tested (Permissions, Port 80, and DNS-01 Config)

Once you know whether your failure is caused by acme.json permissions (0644 or 0777) or an unreachable TCP port 80 (urn:ietf:params:acme:error:connection), you can apply the exact fix. If your server is behind CGNAT, an ISP port 80 block, or Cloudflare Orange-Cloud proxying (or if you want a single wildcard certificate *.yourdomain.com covering all your internal Docker subdomains), configure Traefik to use the Cloudflare DNS-01 challenge instead of HTTP-01. Before blaming ACME servers on WSL 2 testbeds, confirm outbound UDP/53 container lookups work (Docker WSL2 DNS resolution fix), compare memory overhead in our Traefik vs Caddy vs Nginx Proxy Manager benchmark, and remember that terminating TLS in Traefik also resolves browser cookie blocks (n8n Secure Cookie error in Docker).

Step 1: Generate a Scoped Cloudflare DNS API Token

Never use your account-wide Global API Key (CF_API_KEY). Instead, create a least-privilege API Token restricted to DNS edits on your single domain:
1. Log in to the Cloudflare Dashboard.
2. Navigate to My Profile > API Tokens > Create Token.
3. Select the Edit zone DNS template.
4. Set permissions to:
- Zone - DNS - Edit
- Zone - Zone - Read
5. Under Zone Resources, select Include - Specific zone - yourdomain.com.
6. Click Continue to Summary, create the token, and copy the secret value.

Cloudflare scoped API token verification and dig _acme-challenge TXT record lookup
Verifying the two required operations for Traefik's Cloudflare DNS-01 provider (lego): CF_DNS_API_TOKEN requires Zone:Zone:Read to resolve the domain's zone ID and Zone:DNS:Edit to create the temporary _acme-challenge.<domain> TXT record queried by public DNS resolvers (1.1.1.1:53 and 8.8.8.8:53).

Why does Traefik's underlying ACME library (lego) require both Zone:Zone:Read and Zone:DNS:Edit permissions on that token? During a DNS-01 challenge, Traefik performs a two-stage API sequence over outbound HTTPS (port 443) to https://api.cloudflare.com/client/v4/. First, it queries GET /client/v4/zones?name=yourdomain.com (which requires Zone:Zone:Read) to translate your domain name into its 32-character hexadecimal Cloudflare Zone ID. Second, it calls POST /client/v4/zones/<zone_id>/dns_records (which requires Zone:DNS:Edit) to publish a temporary TXT record at _acme-challenge.yourdomain.com containing the cryptographic challenge digest.

Before Traefik tells Let's Encrypt to verify the record, it queries the configured DNS resolvers (such as 1.1.1.1:53 and 8.8.8.8:53) until the new TXT value propagates, and then deletes the temporary TXT record automatically once the certificate is issued:

Cloudflare Edit zone DNS scoped API token template and DNS-01 TXT lifecycle inspector
Inspecting the least-privilege Cloudflare API Token configuration required for Step 1: selecting the Edit zone DNS template with Zone:DNS:Edit and Zone:Zone:Read scoped to Specific zone (yourdomain.com) allows Traefik to pass CF_DNS_API_TOKEN without exposing your account-wide Global API Key.

Step 2: Configure docker-compose.yml for Traefik

Next, configure Traefik's static command flags and environment variables in docker-compose.yml. The option names below match the official Traefik v3.1 ACME documentation, which specifies CF_DNS_API_TOKEN as the scoped token variable for the cloudflare DNS provider and sets 1.1.1.1:53,8.8.8.8:53 as public recursive resolvers so local router DNS caching never delays validation:

version: "3.8"

services:
  traefik:
    image: traefik:v3.1
    container_name: traefik
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    environment:
      # Cloudflare Scoped API Token
      - CF_DNS_API_TOKEN=<cloudflare-dns-api-token> # Replace with your token
    command:
      - "--api.dashboard=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entryPoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"
      # Global HTTP to HTTPS redirection
      - "--entryPoints.web.http.redirections.entryPoint.to=websecure"
      - "--entryPoints.web.http.redirections.entryPoint.scheme=https"
      # ACME DNS-01 configuration
      - "--certificatesresolvers.cloudflare.acme.dnschallenge=true"
      - "--certificatesresolvers.cloudflare.acme.dnschallenge.provider=cloudflare"
      - "--certificatesresolvers.cloudflare.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53"
      - "--certificatesresolvers.cloudflare.acme.email=you@example.com"
      - "--certificatesresolvers.cloudflare.acme.storage=/letsencrypt/acme.json"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    networks:
      - web_gateway

networks:
  web_gateway:
    external: true
Step 2 docker-compose.yml for Traefik v3.1 with Cloudflare DNS-01 challenge and .env file
Complete Step 2 docker-compose.yml for Traefik v3 (left) and docker compose config validation with .env (right): configuring --certificatesresolvers.cloudflare.acme.dnschallenge=true with provider=cloudflare, public resolvers 1.1.1.1:53,8.8.8.8:53, and storage=/letsencrypt/acme.json.

Step 3: Preparing the Local acme.json Certificate Store

Before starting the Traefik container on a Linux or macOS host, pre-create the ./letsencrypt directory, create an empty acme.json regular file, and lock its permissions to 600 (-rw-------):

mkdir -p ./letsencrypt
touch ./letsencrypt/acme.json
chmod 600 ./letsencrypt/acme.json

Running these three commands before docker compose up -d avoids two frequent filesystem traps. First, if you bind-mount a single file path (such as - ./letsencrypt/acme.json:/letsencrypt/acme.json) before the file exists on disk, Docker Engine automatically creates acme.json on the host as a drwxr-xr-x directory, causing Traefik to fail at startup with read /letsencrypt/acme.json: is a directory. Second, running touch ./letsencrypt/acme.json without chmod 600 leaves the file at mode 0644 (-rw-r--r--) under standard umask 022, which triggers the permissions 644 for /letsencrypt/acme.json are too open, please use 600 error:

Comparison of missing acme.json mounted as a directory or 0644 umask versus pre-created 0600 file
Why Step 3 pre-creates and locks ./letsencrypt/acme.json before starting Traefik: mounting a non-existent file path creates a directory (read /letsencrypt/acme.json: is a directory) and default umask 022 creates a 0644 file (left), whereas touch followed by chmod 600 guarantees a -rw------- (600) regular file (right).

Docker Desktop on Windows: Where You Create acme.json Matters

On a Linux host, running chmod 600 on the host file is normally all you need (I did not test a native Linux host here). With Docker Desktop on Windows, however, a relative bind mount like ./letsencrypt is a Windows folder shared into the Linux container across the WSL 2 DrvFS/9P boundary, and I got two completely different permission modes depending on which side created the file. Both runs below used Traefik v3.1 on Docker Desktop (WSL 2 backend, Windows 11) on 2025-01-31, with the exact same bind mount and resolver flags and no published ports.

Created and set to 600 inside a container. A helper container (gfl-lab) with the same Windows folder bind-mounted ran touch and chmod 600 on acme.json via /lab/traefik_bindmount.sh. The mode stayed 600 inside gfl-lab, Traefik saw 600 /letsencrypt/acme.json too, and there were zero ACME permission errors at startup:

acme.json chmod 600 inside a container bind-mounted from Windows and 3 storage paths compared
Created and set to 600 from inside a helper container (/lab/traefik_bindmount.sh): the file mode stays 600 in both the helper container (/lab/acme-bind/acme.json) and the Traefik container (/letsencrypt/acme.json), producing zero ACME startup errors.

Why did creating and running chmod 600 inside the helper container work cleanly on the Windows bind mount? When a Linux process inside a Docker Desktop container executes chmod 600 on a mounted folder, WSL 2 records the POSIX mode metadata so subsequent containers mounting that path observe 600 (-rw-------).

Created on the Windows side. In contrast, when an empty acme.json file was written directly from Windows into a second bind-mounted folder with no chmod executed inside a container (/lab/traefik_winfile.sh), the file showed up as mode 777 (-rwxrwxrwx) inside both the helper container (777 /lab/acme-win/acme.json) and the Traefik container (777 /letsencrypt/acme.json). At startup, Traefik immediately dropped the certificate resolver and logged permissions 777 for /letsencrypt/acme.json are too open, please use 600:

acme.json created on the Windows side showing mode 777 inside containers and ACME resolver skipped
Created from the Windows side with no chmod (/lab/traefik_winfile.sh): the file appears inside both containers with mode 777 (-rwxrwxrwx), causing Traefik to skip the resolver with permissions 777 for /letsencrypt/acme.json are too open, please use 600.

So on Docker Desktop for Windows, either create and lock acme.json from inside a Linux container rather than from the Windows side, or use a Docker named volume. Note that the Windows-side file in /lab/traefik_winfile.sh was written by one Windows process; I did not test Windows Explorer or other text editors separately. Running touch and chmod 600 from Git Bash or PowerShell on Windows is a different path that I did not test, and I also did not test whether running a later chmod 600 from inside a container fixes an existing file that Windows created.

A third path that worked automatically: in my 2025-01-31 Pebble runs, acme.json lived inside a fresh Docker named volume (-v traefik_le:/letsencrypt) instead of a Windows host folder. Because a Docker named volume resides natively inside the Docker Desktop Linux VM ext4 filesystem, Traefik created /letsencrypt/acme.json itself and it came out as -rw------- (600) both times.

Step 4: Expose Services with Traefik Docker Labels

Once Traefik is running with a valid 0600 acme.json store and the cloudflare DNS-01 resolver, you can attach an HTTPS router and a wildcard certificate (yourdomain.com + *.yourdomain.com) to any backend container (such as n8n) using Docker Compose labels:

Traefik n8n@docker router inspector showing Host rule on websecure and wildcard SAN domains
Inspecting the n8n@docker router in Traefik after attaching Step 4 Docker Compose labels: Traefik binds Host("n8n.yourdomain.com") to the websecure (:443) entrypoint, assigns the cloudflare DNS-01 resolver, and registers the wildcard SAN domain pair (yourdomain.com and *.yourdomain.com).

Because we set --providers.docker.exposedbydefault=false in Step 2, containers on the Docker host remain hidden from the reverse proxy unless they explicitly declare traefik.enable=true. The labels below bind the n8n router to the websecure (:443) entrypoint, assign certresolver=cloudflare, and request both the apex domain (main=yourdomain.com) and the wildcard Subject Alternative Name (sans=*.yourdomain.com) over the shared external web_gateway bridge network:

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.n8n.rule=Host(`n8n.yourdomain.com`)"
      - "traefik.http.routers.n8n.entrypoints=websecure"
      - "traefik.http.routers.n8n.tls.certresolver=cloudflare"
      # Request wildcard certificate
      - "traefik.http.routers.n8n.tls.domains[0].main=yourdomain.com"
      - "traefik.http.routers.n8n.tls.domains[0].sans=*.yourdomain.com"
    networks:
      - web_gateway

networks:
  web_gateway:
    external: true

Remember that wildcard SAN certificates (*.yourdomain.com) are only supported by the ACME DNS-01 challenge; attempting to request a wildcard domain with httpChallenge or tlsChallenge will be rejected by Let's Encrypt:

Step 4 n8n Docker Compose wildcard SAN labels and populated acme.json JSON schema
Step 4 Docker labels on the n8n backend service (left) alongside the internal JSON schema of a populated /letsencrypt/acme.json file (right): when issuance succeeds, Traefik populates the Certificates array with base64-encoded PEM chains and private keys under the resolver key.

Verification & Certificate Inspection

After starting Traefik and your backend service container, verify certificate registration and issuance first by inspecting the Traefik container logs:

docker logs -f traefik

To verify which X.509 certificate Traefik actually presents on port 443, query the live endpoint with openssl s_client and pass the target hostname via -servername (TLS Server Name Indication). This is the exact command I used in the Pebble test:

echo | openssl s_client -connect n8n.yourdomain.com:443 -servername n8n.yourdomain.com 2>/dev/null | openssl x509 -noout -subject -issuer

Always include -servername n8n.yourdomain.com when running openssl s_client. Because Traefik selects certificates dynamically based on the TLS SNI extension in the ClientHello packet, omitting -servername (for example, when testing against an IP address or port forward) causes Traefik to return CN=TRAEFIK DEFAULT CERT even when a valid certificate is sitting inside acme.json:

Verifying acme.json with jq and live TLS SNI certificates with openssl s_client
Verifying live certificate storage and delivery with jq and openssl s_client -servername: when issuance fails, .Certificates in acme.json remains null and Traefik serves CN=TRAEFIK DEFAULT CERT (left); once issued, acme.json stores the PEM bundle and SNI queries return the CA issuer and Subject Alternative Name (right).

An issuer of CN=TRAEFIK DEFAULT CERT when -servername is properly specified means Traefik had no ACME certificate matching that router's hostname. In my port-80-open run, the issuer was CN=Pebble Intermediate CA 7f0e26; against production Let's Encrypt, you will see a Let's Encrypt intermediate issuer (such as C=US, O=Let's Encrypt, CN=R10 or CN=E5) and .Certificates in /letsencrypt/acme.json will contain a non-empty array of base64-encoded PEM bundles.

Bringing together the quantitative measurements from all four of our Docker Desktop lab experiments reveals a clear operational pattern. File permission mistakes (0644 or 0777) abort the resolver at startup in under 0.2 seconds before any network packet leaves the container, while reachable HTTP-01 issuance completes in 5 seconds versus 27 seconds across 3 failed validation retries when port 80 is closed on :8081:

Matplotlib benchmark chart of ACME HTTP-01 issuance vs timeout latency and acme.json permission modes
Summary of measured ACME timing and file-mode tests across our Docker Desktop runs: port-80-open HTTP-01 issuance completes in 5 seconds versus 27 seconds to fail across 3 validation attempts when port 80 is closed (left), while any acme.json mode wider than 0600 (such as 0644 from default umask or 0777 from a Windows host file) causes Traefik to drop the resolver immediately at startup (right).

From a network architecture perspective, the difference between HTTP-01 and Cloudflare DNS-01 comes down to connection directionality. As illustrated in the topology diagram below, HTTP-01 requires an unblocked inbound TCP connection from the ACME server's validation vantage points to port 80 on your host (`http://app.gfl.test:80/.well-known/acme-challenge/`), which fails whenever CGNAT, ISP port filtering, a firewall, or a non-80 entrypoint stands in the way.

By contrast, DNS-01 requires zero inbound connections to your Docker host. Traefik initiates an outbound HTTPS request on port 443 to the Cloudflare API using your scoped CF_DNS_API_TOKEN, publishes the temporary _acme-challenge TXT record, verifies propagation against 1.1.1.1:53 and 8.8.8.8:53, and stores the issued wildcard certificate inside your 0600 /letsencrypt/acme.json volume:

System architecture diagram comparing ACME HTTP-01 inbound port 80 versus Cloudflare DNS-01 outbound API
End-to-end architectural comparison of ACME HTTP-01 versus Cloudflare DNS-01 in Traefik: while HTTP-01 requires inbound TCP port 80 from the ACME server to Traefik's web entrypoint, DNS-01 uses an outbound HTTPS API call (CF_DNS_API_TOKEN) to publish a _acme-challenge TXT record on Cloudflare DNS and stores the resulting wildcard certificate in a 0600 acme.json volume.

Use the decision matrix below as a quick diagnostic runbook whenever a Traefik container serves CN=TRAEFIK DEFAULT CERT or logs an ACME challenge error. Start by checking the exact acme.json octal permissions inside the container (600 required, never 644 or 777), confirm that acme.json is a regular file rather than a Docker-created directory, and choose between HTTP-01 (public VPS with open TCP port 80 and single-host FQDNs) and Cloudflare DNS-01 (home labs behind CGNAT/ISP filtering, Cloudflare-proxied domains, or wildcard SAN certificates).

ACME Challenge / Storage Path Required Port / File Mode Wildcard Certs Measured Outcome
HTTP-01 (Port 80 Open) Inbound TCP :80 + 0600 acme.json No (Single FQDN) Issued in 5s (CN=Pebble Intermediate CA)
HTTP-01 (Port 80 Closed / :8081) Blocked TCP :80 No Fails after 27s (3 retries) → CN=TRAEFIK DEFAULT CERT
DNS-01 (Cloudflare API) Outbound HTTPS :443 + DNS :53 Yes (*.domain.com) Works behind CGNAT/firewalls with scoped CF_DNS_API_TOKEN
Windows Host File vs Named Volume 0777 (Win File) vs 0600 (Volume) All Modes 0777/0644 skipped at startup; 0600 loads with 0 errors
Decision matrix and troubleshooting reference card for Traefik Let's Encrypt and Cloudflare DNS-01
Decision matrix and troubleshooting reference for Traefik Let's Encrypt deployments: mapping exact docker logs and openssl s_client symptoms (0644/0777 permissions, directory mount trap, urn:ietf:params:acme:error:connection on port 80, and CN=TRAEFIK DEFAULT CERT) to their root causes and comparing HTTP-01, TLS-ALPN-01, and Cloudflare DNS-01.

Last reviewed: 2025-02-01. Reproduced with Traefik v3.1 on Docker Desktop (Windows 11, WSL 2 backend, Docker Engine 27.3.1): acme.json at 644 vs 600 (2025-01-31); a file created in a container vs on the Windows side (2025-01-31); and with Traefik 3.1.7, the HTTP-01 challenge with port 80 open (certificate issued in 5 s) and closed on 8081 (urn:ietf:params:acme:error:connection after 27 s) against Pebble, Let's Encrypt's test CA, whose certificates are not publicly trusted. Not tested: real Let's Encrypt and a public domain, CGNAT or ISP port blocking, Cloudflare proxying, the live Cloudflare DNS-01 setup and wildcard certificates against production Let's Encrypt, and a later chmod 600 on a Windows-created acme.json.

Interactive Lab Verification Checklist 0 / 3 Verified
Check 1: Ensure acme.json is a regular file with 0600 (-rw-------) permissions (create it inside a container or use a Docker named volume on Windows)
Check 2: Switch from HTTP-01 to Cloudflare DNS-01 (CF_DNS_API_TOKEN with Zone:Read and DNS:Edit) when port 80 is blocked by your ISP or CGNAT
Check 3: Verify live certificate issuance with openssl s_client -connect <host>:443 -servername <host> to confirm CN=TRAEFIK DEFAULT CERT is replaced

Traefik v3 acme.json Permissions & Let's Encrypt ACME Q&A

Why did Traefik ignore my Let's Encrypt resolver when acme.json had 0644 permissions?

Traefik enforces strict private-key file security on startup: if acme.json permissions are wider than 0600, Traefik logs permissions 644 for acme.json are too open and disables ACME certificate issuance. Run chmod 600 acme.json before starting Traefik.

When should I switch Traefik from HTTP-01 to Cloudflare DNS-01 ACME challenges?

Use DNS-01 whenever inbound TCP port 80 is blocked by your ISP, when issuing wildcard certificates (*.example.com), or when Cloudflare proxy orange-cloud settings or strict SSL modes interfere with /.well-known/acme-challenge/ HTTP callbacks.

Why should I test ACME config against Let's Encrypt Staging before switching to production?

Let's Encrypt production enforces strict failed-validation rate limits (5 failures per account, per hostname, per hour). Verifying DNS-01 token propagation against the staging caServer URL first avoids locking out your domain for an hour.

100% Client-Side Utilities · Printable A4 Runbook

Run Prefilled Sizing Math & Download the 1-Page Runbook

Generate Traefik v3, Caddy 2, Nginx, and Cloudflare Tunnel TLS configs with UFW-safe 127.0.0.1 backend port bindings.

Paired Prefilled Calculators & Vector PDF Checklist

Yun Sanghun (M. Yun) · Linux, Docker & AI Infrastructure Engineer