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-------):


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 tochmod 600 ./letsencrypt/acme.json(or create it inside a container or Docker named volume on Windows). If your permissions are already600but Traefik logsurn:ietf:params:acme:error:connectionon port80because of ISP port blocking, CGNAT, or Cloudflare proxying, switch fromHTTP-01to the CloudflareDNS-01challenge using a scopedCF_DNS_API_TOKENso Traefik validates domain ownership via DNSTXTrecords without requiring inbound port80.
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:

Why HTTP-01 Fails: The Root Causes
- 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
80terminate at the carrier edge and never reach your home lab router. - ISP Port 80 Filtering: Even when you have a dedicated public IPv4 address, consumer broadband providers frequently filter inbound TCP port
80to block residential web servers. Because the ACMEHTTP-01specification strictly hardcodes port80for initial token fetches, remapping your router or moving Traefik'swebentrypoint to another port such as8080or8081does not work (see the empirical Pebble measurement below). - 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. - File Permissions on
acme.json: Traefik refuses to load or register an ACME resolver ifacme.jsonpermissions are broader than600(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):

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.jsonjust5 safter container startup, Pebble loggedauthz 7Wz-IaNGd37jisRtDcDh8iL7A7T_YZQDU-0L90_M2Vo set VALID by completed challenge, and runningopenssl s_client -servername app.gfl.testfrom a client container returnedissuer=CN=Pebble Intermediate CA 7f0e26. - Inside Traefik's HTTP router table (
/dashboard/#/http/routersand/api/http/routers), Traefik automatically wires an internal high-priority router namedacme-http@internalmatchingPathPrefix(`/.well-known/acme-challenge/`)onto thewebentrypoint alongside our application routerapp@dockermatchingHost(`app.gfl.test`)onwebsecure(:443):

- Port 80 closed (
--entrypoints.web.address=:8081): No certificate was stored inacme.jsonafter27 s. Traefik loggedERR Unable to obtain ACME certificate for domainswithacme: 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 loggedStarting 3 validations, marked both the authorization (fBX9TIeIDYODkz-eiXWdlAPPvCDJ4neuWJoJnwRAXRg) and the order (YnnHGJp-zD04yxDuxfXUI8c0ZpvayW7n3-iYn2qxZS8) asINVALID, and Traefik servedsubject=CN=TRAEFIK DEFAULT CERT/issuer=CN=TRAEFIK DEFAULT CERTinstead. - In both Case 1 and Case 2,
/letsencrypt/acme.jsonlived 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):

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:

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.

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:

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 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:

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:

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:

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:

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:

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:

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:

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/
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:

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 |

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.
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.
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.