Hello everyone,
I am using the following configuration:
global:
checkNewVersion: true
sendAnonymousUsage: false
log:
level: DEBUG
format: common
filePath: /var/log/traefik/traefik.log
accesslog:
format: common
filePath: /var/log/traefik/access.log
api:
dashboard: true
insecure: true
entryPoints:
web:
address: :80
http:
middlewares:
- crowdsec-bouncer@file
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
http:
middlewares:
- crowdsec-bouncer@file
certificatesResolvers:
staging:
acme:
email: <removed>
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
httpChallenge:
entryPoint: web
production:
acme:
email: <removed>
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-v02.api.letsencrypt.org/directory"
httpChallenge:
entryPoint: web
providers:
docker:
exposedByDefault: false
file:
directory: /etc/traefik/fileProviders
watch: true
I then add labels to the dockers containers I wish to make accessible through traefik:
labels:
- "traefik.enable=true"
# HTTP Routers
- "traefik.http.routers.example-rtr.entrypoints=websecure"
- "traefik.docker.network=traefik-reverse-proxy"
- "traefik.http.routers.example-rtr.rule=Host(`example.mydomain.com`)"
- "traefik.http.routers.example-rtr.tls=true"
- "traefik.http.routers.example-rtr.tls.certresolver=production"
# HTTP Services
- "traefik.http.routers.example-rtr.service=example-svc"
- "traefik.http.services.example-svc.loadbalancer.server.port=80"
It works great, every HTTP request is redirected to HTTPS.
However, when trying to access non-existent subdomains, it gives me a 404 error but it also redirects me to a HTTPS page.
Traefik will then serve the default certificate so I get a warning about the certificate.
Is there a way to have either the redirection disabled for error pages or to have some sort of wildcard certificate served for all of my domain ?
I thank you in advance for your help !
Regards,
Azsde.