Was trying to expose traefik dashboard on a non standard port. Here is my docker-compose.yml
version: "3.9"
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 2083:2083
- 8080:8080
- 443:443
environment:
- CF_API_EMAIL={$email}
- CF_DNS_API_TOKEN={$token}
volumes:
- /etc/localtime:/etc/localtime:ro
- /run/user/1000/docker.sock:/var/run/docker.sock:ro
- ~/traefik/traefik.yml:/traefik.yml:ro
- ~/traefik/acme.json:/acme.json
- ~/traefik/dynamic.yml:/dynamic.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=dashboard"
- "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)"
- "traefik.http.routers.api.entrypoints=dashboard"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.tls.certresolver=cloudflare"
- "traefik.http.routers.traefik.tls.domains[0].main=*.example.com"
- "traefik.http.routers.traefik.tls.domains[0].sans=example.com"
- "traefik.http.routers.traefik.service=api@internal"
networks:
proxy:
external: true
name: proxy
driver: bridge
default:
driver: bridge
traefik.yml has the following lines:
api:
dashboard: true
debug: true
log:
level: INFO
entryPoints:
http:
address: ":80"
dashboard:
address: ":2083"
https:
address: ":443"
serversTransport:
insecureSkipVerify: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
file:
filename: /dynamic.yml
watch: true
certificatesResolvers:
cloudflare:
acme:
email: email@example.com
storage: acme.json
dnsChallenge:
provider: cloudflare
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
and the last is the content of dynamic.yml:
# dynamic.yml
http:
routers:
dashboard:
entrypoints:
- dashboard
rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
service: api@internal
middlewares:
- user-auth
middlewares:
https-redirect:
redirectScheme:
scheme: https
permanent: false
port: 443
default-headers:
headers:
frameDeny: true
sslRedirect: true
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
stsSeconds: 155520011
referrerPolicy: no-referrer
featurePolicy: true
SSLHost: example.com
user-auth:
basicAuth:
users:
- "user:$pass"
Everything works once I switch to a standard 443 port. Once the port is different I obtain "page not found 404". Any help is appreciated. My goal was to forward HTTPS traffic also to another port if it is possible. I run rootless Docker under Fedora Server 37.