Hey, I do have this error while starting traefik:
level=error msg="Error while building configuration (for the first time): yaml: line 50: mapping values are not allowed in this context" providerName=file
The next error is:
level=error msg="middleware \"secureHeaders@file\" does not exist" entryPointName=websecure routerName=traefik-secure@docker
This is my static configuration
log:
level: DEBUG
api:
dashboard: true
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
websecure:
address: :443
http:
middlewares:
- secureHeaders@file
tls:
certResolver: cloudflare
domains:
- main: 'example.com'
sans:
- '*.example.com'
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
network: traefik
file:
filename: "/etc/traefik/dynamic.yml"
certificatesResolvers:
cloudflare:
acme:
email: email@example.com
storage: acme.json
dnsChallenge:
provider: cloudflare
My docker compose file
version: "2.2"
services:
traefik:
image: traefik:2.10
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- traefik
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./config/traefik.yml:/etc/traefik/traefik.yml:ro
- ./config/dynamic.yml:/etc/traefik/dynamic.yml:ro
- ./config/acme.json:/etc/traefik/acme.json
environment:
- CF_API_EMAIL= xxx
- CF_DNS_API_TOKEN= xxx
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik-secure.entrypoints=websecure"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.example.com`)"
- "traefik.http.routers.traefik-secure.service=api@internal"
- "traefik.http.routers.traefik-secure.middlewares=user-auth@file"
networks:
traefik:
external: true
name: traefik
I am going insane, why do I keep getting theese errors.
My syntax match the official documentation
Can anybody please give me some advice?
Maybe I am blind and what I need is another point of view
Thank you