Howdy, all!
So I am new to Traefik and after a long uphill battle, I have gotten it to work on inside of docker! ( woohoo). However, my only issue is that I cannot access the addresses outside of my home network. I could do this with a Cloudflare tunnel, but I am committed to finishing this project and getting it working 100%. For reference, I was following this guide:
my docker-compose.yaml is:
version: "3.8"
services:
traefik:
image: traefik:v3.0
container_name: traefik
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
secrets:
- cf_api_token
env_file: .env
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
# - ./data/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefikdash.mydomain.com`)"
- "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(`traefikdash.mydomain.com`)"
- "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.com"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.mydomain.com"
- "traefik.http.routers.traefik-secure.service=api@internal"
secrets:
cf_api_token:
file: ./cf_api_token.txt
networks:
proxy:
name: proxy
external: true
and my traefik.yml is:
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: true
# file:
# filename: /config.yml
certificatesResolvers:
cloudflare:
acme:
email: myemail@gmail.com
storage: acme.json
caServer: https://acme-v02.api.letsencrypt.org/directory # prod (default)
dnsChallenge:
provider: cloudflare
disablePropagationCheck: true
delayBeforeCheck: 60s
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
I can access the dashboard and I have been able to setup a test nginx template address, all that works except I am unable to access outside the homenetwork. The SSL certs are all valid and nslookup works both for the A and CNAME records that I have on cloudflare.
Now I know I won't be exposing traefik externally, but I would like to know how what I am missing in order to allow external access so that when I get other projects up and running I won't have to start from the beginning if I make a mistake here.
Hoping someone can help.
Brian