I'm pretty new to Traefik to start with. Everything working as expected with Traefik and I'll get certs for services under the same Docker host, but as soon as I try to do this with my Proxmox host or Pihole (this are the two I've tried with) it doesn't work.
I've done more or less exactly like Techno Tim does but for me it's not working.
docker-compose.yml:
services:
traefik:
container_name: traefik
image: traefik:v3.3.3
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
environment:
CF_DNS_API_TOKEN_FILE: /run/secrets/cf_api_token
TRAEFIK_DASHBOARD_CREDENTIALS: ${TRAEFIK_DASHBOARD_CREDENTIALS}
secrets:
- cf_api_token
env_file: .env
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /docker/traefik/traefik.yml:/traefik.yml:ro
- /docker/traefik/acme.json:/acme.json
- /docker/traefik/logs:/var/log/traefik
- /docker/traefik/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`td.domain`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_DASHBOARD_CREDENTIALS}"
- "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(`td.domain`)"
- "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=domain"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain"
- "traefik.http.routers.traefik-secure.service=api@internal"
secrets:
cf_api_token:
file: ./cf_api_token.txt
networks:
proxy:
name: proxy
external: true
traefik.yml:
global:
sendAnonymousUsage: false
api:
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: email@domain
storage: acme.json
caServer: https://acme-v02.api.letsencrypt.org/directory # prod (default)
# caServer: https://acme-staging-v02.api.letsencrypt.org/directory # staging
dnsChallenge:
provider: cloudflare
#disablePropagationCheck: true # uncomment this if you have issues pulling certificates through cloudflare, By setting this flag to true disables the need to wait for the propagation of the TXT record to all authoritative name servers.
#delayBeforeCheck: 60s # uncomment along with disablePropagationCheck if needed to ensure the TXT record is ready before verification is attempted
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
log:
level: DEBUG
config.yml:
http:
#region routers
routers:
proxmox:
entryPoints:
- "https"
rule: "Host(`pve.domain`)"
middlewares:
- default-headers
- https-redirectscheme
tls: {}
service: proxmox
pihole:
entryPoints:
- "https"
rule: "Host(`pihole.domain`)"
middlewares:
- default-headers
- https-redirectscheme
tls: {}
service: pihole
#endregion
#region services
services:
proxmox:
loadBalancer:
servers:
- url: "https://192.168.20.10:8006"
passHostHeader: true
pihole:
loadBalancer:
servers:
- url: "http://192.168.1.10:80"
passHostHeader: true
#endregion
middlewares:
https-redirectscheme:
redirectScheme:
scheme: https
permanent: true
default-headers:
headers:
frameDeny: true
sslRedirect: true
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
stsSeconds: 15552000
customFrameOptionsValue: SAMEORIGIN
customRequestHeaders:
X-Forwarded-Proto: https
default-whitelist:
ipWhiteList:
sourceRange:
- "192.168.0.0/16"
- "172.16.0.0/12"
- "10.0.0.0/8"
secured:
chain:
middlewares:
- default-whitelist
- default-headers
My Proxmox host is on the same VLAN and there is no problems with the traffic between the VLANs either. In the logs I can't see any errors and to me it looks like it should work.
I can see this in the log if it says anything:
DBG github.com/traefik/traefik/v3/pkg/server/router/tcp/manager.go:237 > Adding route for pihole.domain with TLS options default entryPointName=https
DBG github.com/traefik/traefik/v3/pkg/tls/tlsmanager.go:321 > No default certificate, fallback to the internal generated certificate tlsStoreName=default
DBG github.com/traefik/traefik/v3/pkg/middlewares/redirect/redirect_scheme.go:29 > Creating middleware entryPointName=http middlewareName=redirect-http-to-https@internal middlewareType=RedirectScheme routerName=http-to-https@internal
DBG github.com/traefik/traefik/v3/pkg/middlewares/redirect/redirect_scheme.go:30 > Setting up redirection to https 443 entryPointName=http middlewareName=redirect-http-to-https@internal middlewareType=RedirectScheme routerName=http-to-https@internal
DBG github.com/traefik/traefik/v3/pkg/middlewares/recovery/recovery.go:25 > Creating middleware entryPointName=http middlewareName=traefik-internal-recovery middlewareType=Recovery
DBG github.com/traefik/traefik/v3/pkg/server/service/service.go:313 > Creating load-balancer entryPointName=https routerName=pihole@file serviceName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/server/service/service.go:350 > Creating server entryPointName=https routerName=pihole@file serverName=f3c24xxxx573dc serviceName=pihole@file target=http://192.168.1.10:80
DBG github.com/traefik/traefik/v3/pkg/middlewares/redirect/redirect_scheme.go:29 > Creating middleware entryPointName=https middlewareName=https-redirectscheme@file middlewareType=RedirectScheme routerName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/middlewares/redirect/redirect_scheme.go:30 > Setting up redirection to https entryPointName=https middlewareName=https-redirectscheme@file middlewareType=RedirectScheme routerName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/middlewares/headers/headers.go:27 > Creating middleware entryPointName=https middlewareName=default-headers@file middlewareType=Headers routerName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/middlewares/headers/headers.go:41 > Setting up secureHeaders from {map[X-Forwarded-Proto:https] map[] false [] [] [] [] [] 0 false [] [] map[] 15552000 true true true true SAMEORIGIN true true false <nil> 0xc00141c9b0 <nil> <nil> <nil>} entryPointName=https middlewareName=default-headers@file middlewareType=Headers routerName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/middlewares/headers/headers.go:47 > Setting up customHeaders/Cors from {map[X-Forwarded-Proto:https] map[] false [] [] [] [] [] 0 false [] [] map[] 15552000 true true true true SAMEORIGIN true true false <nil> 0xc00141c9b0 <nil> <nil> <nil>} entryPointName=https middlewareName=default-headers@file middlewareType=Headers routerName=pihole@file
DBG github.com/traefik/traefik/v3/pkg/middlewares/observability/middleware.go:33 > Adding tracing to middleware entryPointName=https middlewareName=default-headers@file routerName=pihole@file
I've spent too many hours now trying to solve this without any luck.