Hi, there. I'm trying to use Traefik with the environment variable configuration and I think there is a bug because is almost the same same configuration using "command" parameters but using environment doesn't work property. The problem is the HTTP to HTTPS redirection which is not working. When I access http://subdomain.duckdns.org it simply shows "404 page not found".
This is my Docker Compose file:
version: '3.3'
services:
traefik:
image: traefik:v2.1
container_name: traefik
restart: always
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${PWD}/acme.json:/acme.json
environment:
- TRAEFIK_API_INSECURE=true
- TRAEFIK_API_DEBUG=true
- TRAEFIK_ACCESSLOG=false
- TRAEFIK_LOG=true
- TRAEFIK_LOG_LEVEL=INFO
- TRAEFIK_PROVIDERS_DOCKER=true
- TRAEFIK_ENTRYPOINTS_HTTP_ADDRESS=:80
- TRAEFIK_ENTRYPOINTS_HTTPS_ADDRESS=:443
- TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT=false
- TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_CASERVER=https://acme-staging-v02.api.letsencrypt.org/directory
- TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=user@domain.com
- TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_STORAGE=/acme.json
- TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_TLSCHALLENGE=true
labels:
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=http
- traefik.http.routers.http-catchall.middlewares=redirect-to-https
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
whoami:
image: containous/whoami
labels:
- traefik.http.routers.my-app.rule=Host(`subdomain.duckdns.org`)
- traefik.http.routers.my-app.tls.certresolver=letsencrypt
- traefik.http.routers.my-app.entrypoints=https
- traefik.http.routers.my-app.tls=true
- traefik.enable=true