I recently tried traefik now
very first, I just use anything else but example
it worked very well.
so I tried one line per try to check any other problem.
it's quite good, but after try basePath
, it suddenly get 404
more worse thing is, it's not work even I commented basePath in config, and remove pathprefix from label. (this was just worked before I tried basepath)
# docker-compose
services:
traefik:
image: traefik:latest
container_name: traefik
secrets:
- cloudflare_api
environment:
- CF_DNS_API_TOKEN=/run/secrets/cloudflare_api
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/docker/config/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
- /opt/docker/config/traefik/data/certs:/var/traefik/certs:rw
networks:
- proxy
labels:
- traefik.enable=true
- traefik.http.routers.dashboard.rule=Host(`server.domain.test`) && PathPrefix(`/traefik`)
- traefik.http.routers.dashboard.service=api@internal
- traefik.http.routers.dashboard.middlewares=auth
- traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/
restart: unless-stopped
networks:
proxy:
external: true
# config/traefik/traefik.yml
global:
checkNewVersion: false
sendAnonymousUsage: false
log:
level: DEBUG
api:
dashboard: true
insecure: false
basePath: /traefik
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
certificatesResolvers:
cloudflare:
acme:
...
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false