What version of Traefik are you using?
v3.0.0-beta5
Are you using docker swarm?
No, I am using docker compose
What version of docker are you running?
Docker version 20.10.22-qnap7, build 57ed8b8
What browser version are you using?
Firefox 121.0 (64-bit)
What version of QNAP OS are you running?
[~] # cat /etc/*release
NAME="QTS"
VERSION="5.1.4 (20231128)"
ID=qts
PRETTY_NAME="QTS 5.1.4 (20231128)"
VERSION_ID="5.1.4"
What are the results of a dig command on your domain name? (note domain name masked in result)
[~] # dig whoami.(my domain name).com
; <<>> DiG 9.10.1-P2 <<>> whoami.(my domain name).com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48960
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;whoami.(my domain name).com. IN A
;; ANSWER SECTION:
whoami.(my domain name).com. 300 IN CNAME (my domain name).com.
(my domain name).com. 3600 IN A 162.245.135.24
;; Query time: 17 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Thu Jan 11 16:49:53 EST 2024
;; MSG SIZE rcvd: 84
[~] #
Here are the contents of the QNAP docker compose traefik.yml file:
secrets:
cloudflare_api_key:
file: '/share/docker/secrets/cloudflare_api_key.secret'
cloudflare_api_email:
file: '/share/docker/secrets/cloudflare_api_email.secret'
cloudflare_domain1-dns_token:
file: '/share/docker/secrets/cloudflare_domain1-dns_token.secret'
htpasswd:
file: '/share/docker/secrets/htpasswd.secret'
services:
traefik:
container_name: traefik
image: traefik:v3.0
# image: traefik:saintmarcelin # v2.10 with security updates
security_opt:
- no-new-privileges:true
restart: always
networks:
- external_edge # rename this to your custom docker network
ports:
- 80:80
- 443:443
- 8080:8080 # Dashboard port
secrets:
- cloudflare_api_email
- cloudflare_domain1-dns_token
- cloudflare_api_key
- htpasswd
env_file:
- $docker_scripts/.vars_docker.env
environment:
- PUID=${var_usr}
- PGID=${var_grp}
- TZ=America/New_York # change to your local timezone
- HTPASSWD_FILE=/run/secrets/htpasswd
- CLOUDFLARE_EMAIL_FILE=/var/run/secrets/cloudflare_api_email
- CLOUDFLARE_API_KEY_FILE=/run/secrets/cloudflare_api_key
- CF_API_EMAIL_FILE=/run/secrets/cloudflare_api_email
- CF_DNS_API_TOKEN_FILE=/run/secrets/cloudflare_domain1-dns-token
- DOMAINNAME_CLOUD_SERVER
- TRAEFIK_API_INSECURE=true
- TRAEFIK_LOG_LEVEL=ERROR
command:
- '--configFile=/etc/traefik/static/traefik.yml'
volumes:
- /etc/timezone:/etc/timezone:ro # Set the container timezone by sharing the read-only localtime
- /var/run/docker.sock:/var/run/docker.sock:ro # Give access to the UNIX Docker
- /$compose_appdata/traefik/certs:/etc/traefik/certs # Set the location where my ACME certificates are saved to
- /$compose_appdata/traefik/logs/:/logs # Set the traefik main log directory
- /$compose_appdata/traefik/dynamic:/etc/traefik/dynamic # Set the dynamic configuration for the file provider
- /$compose_appdata/traefik/static/traefik.yml:/etc/traefik/traefik.yml:ro # Set the static configuration
- /$compose_appdata/traefik/:/etc/traefik/
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
labels:
- 'traefik.enable=true' # Enable Traefik reverse proxy for the Traefik dashboard.
- 'traefik.docker.network=external_edge'
##
## HTTP-to-HTTPS Redirect
- "traefik.http.routers.http-catchall.entrypoints=http"
- "traefik.http.routers.http-catchall.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
## HTTP Routers
- "traefik.http.routers.traefik.entrypoints=https"
# - "traefik.http.routers.traefik.rule=Host(`traefik.(your domain name).com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.traefik.rule=Host(`traefik.(your domain name).com`)"
- "traefik.http.routers.traefik.tls=true" # Some people had 404s without this
- "traefik.http.routers.traefik.tls.certresolver=dns-cloudflare" # Comment out this line after first run of traefik to force the use of wildcard certs
- "traefik.http.routers.traefik.tls.domains[0].main=(your domain name).com"
- "traefik.http.routers.traefik.tls.domains[0].sans=*.(your domain name).com"
## Traefik Local Router
- "traefik.http.routers.traefik-local.entrypoints=https"
- "traefik.http.routers.traefik-local.rule=Host(`traefik.local`)"
- "traefik.http.routers.traefik-local.tls=true"
## Services - API
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik-local.service=api@internal"
## Healthcheck/ping
- "traefik.http.routers.ping.rule=Host(`traefik.(your domain name).com`) && Path(`/ping`)"
- "traefik.http.routers.ping.tls=true"
- "traefik.http.routers.ping.service=ping@internal"
## Middlewares
# Middleware BasicAuth
- "traefik.http.routers.traefik.middlewares=chain-basic-auth@file" # For Basic HTTP Authentication
#- "traefik.http.routers.traefik-rtr.middlewares=chain-no-auth@file" # For No Authentication
# - "traefik.http.routers.traefik.middlewares=chain-oauth@file" # For Google OAuth
#- "traefik.http.routers.traefik.middlewares=chain-authelia@file" # For Authelia Authentication
error-pages:
image: ghcr.io/tarampampam/error-pages:2.26 # Using the latest tag is highly discouraged. Please, use tags in X.Y.Z format
hostname: error-pages
container_name: error-pages
restart: unless-stopped
networks:
- external_edge # rename this to your custom docker network
env_file:
- $docker_scripts/.vars_docker.env
environment:
- TEMPLATE_NAME=matrix # set the error pages template
- PUID=${var_usr}
- PGID=${var_grp}
- TZ=America/New_York # change to your local timezone
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
compress: "true"
labels:
- traefik.enable=true
# use as "fallback" for any NON-registered services (with priority below normal)
- traefik.http.routers.error-pages-router.rule=HostRegexp(`{host:.+}`)
- traefik.http.routers.error-pages-router.priority=10
# should say that all of your services work on https
- traefik.http.routers.error-pages-router.entrypoints=http
- traefik.http.routers.error-pages-router.middlewares=error-pages-middleware
# "errors" middleware settings
- traefik.http.middlewares.error-pages-middleware.errors.status=400-599
- traefik.http.middlewares.error-pages-middleware.errors.service=error-pages-service
- traefik.http.middlewares.error-pages-middleware.errors.query=/{status}.html
# define service properties
- traefik.http.services.error-pages-service.loadbalancer.server.port=8080
depends_on:
- traefik
networks:
external_edge:
external: true```