I am running into a slight issue with redirecting http to https traffic with Traefik. So far, my https router with acme is working fine, but I have two problems I am try to overcome.
- I have to manually specify
https://domainto go through the the https route. Otherwise it tries to go through the http route and gets a 404. - Even when I am manually typing in
https://domainit works for the most part, but in some paths, for no reason, it will try to go via the http route, and gets a 404.
How can I make sure that the route is always using https for every path in the route whether https was typed into the address bar?
The entrypoints are name http and https. My partially working setup:
- "traefik.enable=true"
- traefik.port=8000
- traefik.backend=myapp
- traefik.http.routers.myapp.rule=Host(`sub.mydomain.com`)
- "traefik.http.routers.myapp.entrypoints=https"
- "traefik.http.routers.myapp.tls.certresolver=myresolver"
# redir http to https
- "traefik.http.routers.myapp-secure.rule=Host(`sub.mydomain.com`) && PathPrefix({p:.+})"
- "traefik.http.routers.myapp-secure.entrypoints=https"
- "traefik.http.middlewares.myapp-secure.redirectscheme.scheme=https"
- "traefik.http.routers.myapp.middlewares=myapp-secure"
- "traefik.http.routers.myapp-secure.tls=true"