Hi,
I try to setup traefik with acme and a force redirect to https but it's not working. Here is my config:
traefik:
image: traefik:v2.0
command:
- "--log.level=INFO"
# - "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.http.acme.httpchallenge=true"
- "--certificatesresolvers.http.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.http.acme.email=<email>"
- "--certificatesresolvers.http.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
- "8080:8080"
networks:
- web
volumes:
- acme:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
nginx:
image: nginx:alpine
networks:
- web
labels:
traefik.docker.network: web
traefik.enable: true
traefik.http.routers.<name>.tls.certresolver: http
traefik.http.routers.<name>.rule: Host(`<name>.com`,`www.<name>.com`)
traefik.http.routers.<name>.entrypoints: web
traefik.http.middlewares.https-redirect.redirectscheme.scheme: https
traefik.http.routers.<name>.middlewares: https-redirect@docker
traefik.http.routers.<name>-secured.rule: Host(`<name>.com`,`www.<name>.com`)
traefik.http.routers.<name>-secured.entrypoints: websecure
traefik.http.routers.<name>-secured.tls: true
If I open the domain with http, I get a 404 error. If I change the schema to https, the page is displayed.