Hello
Been trying to setup Traefik for a while now. Followed many tutorials and retried many times, but I'm not able to generate a certificate.
This is the error I'm getting (I changed the domain):
2024-05-02T12:05:09Z ERR Unable to obtain ACME certificate for domains error="unable to generate a certificate for the domains [mydomain.win *.mydomain.win]: error: one or more domains had a problem:\n[*.mydomain.win] [*.mydomain.win] acme: error presenting token: cloudflare: could not find zone for domain \"mydomain.win\": [fqdn=_acme-challenge.mydomain.win.] could not find the start of authority for '_acme-challenge.mydomain.win.': DNS call error: read udp 172.24.0.2:48204->1.1.1.1:53: i/o timeout [ns=1.1.1.1:53, question='win. IN SOA']\nDNS call error: read udp 172.24.0.2:39169->1.0.0.1:53: i/o timeout [ns=1.0.0.1:53, question='win. IN SOA']\n[mydomain.win] [mydomain.win] acme: error presenting token: cloudflare: could not find zone for domain \"mydomain.win\": [fqdn=_acme-challenge.mydomain.win.] could not find the start of authority for '_acme-challenge.mydomain.win.': DNS call error: read udp 172.24.0.2:53757->1.1.1.1:53: i/o timeout [ns=1.1.1.1:53, question='win. IN SOA']\nDNS call error: read udp 172.24.0.2:57771->1.0.0.1:53: i/o timeout [ns=1.0.0.1:53, question='win. IN SOA']\n" ACME CA=https://acme-v02.api.letsencrypt.org/directory acmeCA=https://acme-v02.api.letsencrypt.org/directory domains=["mydomain.win","*.mydomain.win"] providerName=cloudflare.acme routerName=traefik-secure@docker rule=Host(`traefik-dashboard.mydomain.win`)
My docker compose file:
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
proxy: null
ports:
- 80:80
- 443:443
- 888:8080
environment:
- CF_DNS_API_TOKEN=*****************
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/stijn/container_configs/traefik/traefik.yml:/traefik.yml:ro
- /home/stijn/container_configs/traefik/acme.json:/acme.json
- /home/stijn/container_configs/traefik/config.yml:/config.yml:ro
- /home/stijn/container_data/traefik/logs:/var/log/traefik
labels:
- traefik.enable=true
- traefik.http.routers.traefik.entrypoints=http
- traefik.http.routers.traefik.rule=Host(`traefik-dashboard.mydomain.win`)
- traefik.http.middlewares.traefik-auth.basicauth.users=****:*************
- traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https
- traefik.http.routers.traefik.middlewares=traefik-https-redirect
- traefik.http.routers.traefik-secure.entrypoints=https
- traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.mydomain.win`)
- traefik.http.routers.traefik-secure.middlewares=traefik-auth
- traefik.http.routers.traefik-secure.tls=true
- traefik.http.routers.traefik-secure.tls.certresolver=cloudflare
- traefik.http.routers.traefik-secure.tls.domains[0].main=mydomain.win
- traefik.http.routers.traefik-secure.tls.domains[0].sans=*.mydomain.win
- traefik.http.routers.traefik-secure.service=api@internal
My traefik.yml config
api:
insecure: true
dashboard: true
debug: true
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
serversTransport:
insecureSkipVerify: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
file:
filename: /config.yml
certificatesResolvers:
cloudflare:
acme:
email: mycloudflareemail@gmail.com #add your email
storage: acme.json
caServer: https://acme-staging-v02.api.letsencrypt.org/directory
dnsChallenge:
#delayBeforeCheck: 45s
provider: cloudflare
#disablePropagationCheck: true
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
Cloudflare settings:
I tried deleting resolvers, disable propagation check, adding delaybefore check.
The output changed a little bit to:
2024-05-05T09:14:35Z ERR Unable to obtain ACME certificate for domains error="unable to generate a certificate for the domains [mydomain.win *.mydomain.win]: error: one or more domains had a problem:\n[*.mydomain.win] [*.mydomain.win] acme: error presenting token: cloudflare: failed to find zone win.: zone could not be found\n[mydomain.win] [mydomain.win] acme: error presenting token: cloudflare: failed to find zone win.: zone could not be found\n" ACME CA=https://acme-staging-v02.api.letsencrypt.org/directory acmeCA=https://acme-staging-v02.api.letsencrypt.org/directory domains=["mydomain.win","*.mydomain.win"] providerName=cloudflare.acme routerName=traefik-secure@docker rule=Host(`traefik-dashboard.mydomain.win`)
Some commands from ubuntu server running traefik
me@ubuntuserver:~$ dig +short traefik-dashboard.mydomain.win 8.8.8.8
192.186.1.81
me@ubuntuserver:~$ dig +short _acme-challenge.mydomain.win 192.168.1.81
172.67.140.167
104.21.65.48
me@ubuntuserver:~$ dig +short _acme-challenge.mydomain.win 8.8.8.8
172.67.140.167
104.21.65.48
me@ubuntuserver:~$ dig SOA traefik-dashboard.mydomain.win 8.8.8.8
(empty)
Can anyone help? Been driving me crazy. Lost so much time with this already
Kind regards