I recently replaced my SWAG reverse proxy with Traefik and it's mostly working, I have only two issues to resolve but I'll focus on one for now.
I use Homer as a dashboard for all the stuff I run on my servers and in the list of links I have a link to Traefik's dashboard in the form of https://dashboard.docker.REDACTED but when I click on the link Traefik sends Firefox a redirect to http://dashboard.docker.REDACTED for some reason and I get an HTTP 404 error. If I open a new tab and enter https://dashboard.docker.REDACTED manually I get the Traefik dashboard as expected.
Here is my docker-compose.yaml file:
version: "3.3"
services:
traefik:
image: "traefik:v2.9"
container_name: "traefik"
command:
- --log.level=DEBUG
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.web.http.redirections.entryPoint.to=https
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
- --entrypoints.websecure.http.tls.domains[0].main=docker.REDACTED
- --entrypoints.websecure.http.tls.domains[0].sans=*.docker.REDACTED
- --entrypoints.websecure.http.tls.certresolver=myresolver
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.myresolver.acme.email=REDACTED
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`dashboard.docker.REDACTED`)"
- "traefik.http.routers.dashboard.service=dashboard"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.services.dashboard.loadbalancer.server.port=8080"
ports:
- 80:80
- 443:443
environment:
- CF_DNS_API_TOKEN=REDACTED
volumes:
- data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro