Hey folks!
After googling a lot and trying tons of combination of settings, I am at the point that I need your infinite knowledge.
As the title says, I get a 404 when trying to access the dashboard in secure mode.
I am not sure I understand the problem, the logs are not helping, only saying that it was routed to https (301) if I omit the "https://", or just 404 if I do put it.
So here is my configuration:
#### traefik.yml
global:
checkNewVersion: true
sendAnonymousUsage: false # true by default
# (Optional) Log information
log:
level: DEBUG # DEBUG, INFO, WARNING, ERROR, CRITICAL
format: json # common, json, logfmt
filePath: /var/log/traefik/traefik.log
#(Optional) Accesslog
accessLog:
format: json # common, json, logfmt
filePath: /var/log/traefik/access.log
# (Optional) Enable API and Dashboard
# ---
api:
dashboard: true # true by default
debug: true
# Entry Points configuration
# ---
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
# Let's encrypt configuration, requires trafik.${ENVIRONMENT}.env:
certificatesResolvers:
production:
acme:
email: [redacted]
storage: /letsencrypt/acme.json
caServer: "https://acme-v02.api.letsencrypt.org/directory"
dnsChallenge:
provider: namedotcom
resolvers:
- "8.8.8.8:53"
- "8.8.4.4:53"
serversTransport:
insecureSkipVerify: true
providers:
docker:
exposedByDefault: false # Default is true
file:
# watch for dynamic configuration changes
directory: /etc/traefik
watch: true
#### docker-compose.yml
services:
traefik:
image: traefik:v2.10.4
container_name: traefik
dns:
- 8.8.8.8
- 8.8.4.4
ports:
- "80:80"
- "443:443"
env_file:
- ./traefik.${ENVIRONMENT}.env
volumes:
- ./config:/etc/traefik
- ./log:/var/log/traefik/
- "/web/letsencrypt:/letsencrypt"
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=${TRAEFIK_HTTP_ROUTERS_RULE}"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.middlewares=auth"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.certresolver=production"
- "traefik.http.middlewares.auth.basicauth.users=admin:[redacted]"
networks:
- traefik_e4portal_api
- traefik_e4portal_web
- traefik_nextcloud
networks:
traefik_e4portal_api:
external: true
traefik_e4portal_web:
external: true
traefik_nextcloud:
external: true
#### env variables:
TRAEFIK_HTTP_ROUTERS_RULE='Host(`dashboard.[redacted].[redacted]`)'
Important note here: I know that the env_file: in the docker compose gets evaluated after compose started, so variables are only working for the container. My TRAEFIK_HTTP_ROUTERS_RULE variable is set elsewhere and I know that it is evaluated correctly: it was correct in docker inspect. So no problem there.
Everything works, except for the dashboard that returns a 404.
The certificates works for other containers (not listed in this post) but traefik uses self-signed for the dashboard (that is another problem, but it might be relevant).
I've tried as a router rule:
Host(`dashboard.[redacted].[redacted]`)
and
Host(`dashboard.[redacted].[redacted]`) && PathPrefix(`/api`, `/dashboard`)
and other combinaison, like && PathPrefix(`/api/`, `/dashboard/`)
(with trailing slashes).
I also tried connecting to the dashboard with /dashboard/, /dashboard, /api, /api/ just for kicks, same thing: 404.
It is probably a typo that I have not found, or something simple as that, but I have exhausted my ideas.
Thanks a lot for your help, you guys are great!