I'm using Traefik 2.4 via docker-compose for development server. Here's config
version: "3.8"
services:
traefik:
image: traefik:v2.4
container_name: traefik
command:
- --api=true
- --api.dashboard=true
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- "--certificatesresolvers.letsEncrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsEncrypt.acme.httpchallenge.entrypoint=web"
# - "--certificatesresolvers.letsEncrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.letsEncrypt.acme.email=$ACME_EMAIL"
- "--certificatesresolvers.letsEncrypt.acme.storage=/certs/acme.json"
restart: always
security_opt:
- no-new-privileges:true
env_file:
- .env
labels:
traefik.enable: true
traefik.http.routers.traefik.entrypoints: web,websecure
traefik.http.routers.traefik.rule: Host(`monitor.$DEFAULT_HOST`)
traefik.http.routers.traefik.tls.certresolver: letsEncrypt
traefik.http.routers.traefik.service: api@internal
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
traefik.http.routers.traefik.middlewares: redirect-to-https
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./custom/:/custom/:ro
- ./certs/:/certs/
ports:
- 80:80
- 443:443
whoami:
image: "traefik/whoami"
container_name: "traefik-whoami"
restart: always
labels:
traefik.enable: true
traefik.http.routers.whoami.entrypoints: web,websecure
traefik.http.routers.whoami.rule: Host(`whoami.$DEFAULT_HOST`)
traefik.http.routers.whoami.tls.certresolver: letsEncrypt
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
traefik.http.routers.traefik.middlewares: redirect-to-https
networks:
default:
external:
name: $DEFAULT_NETWORK
I'm using flags configuration on purpose, because it's easier to configure using ENV variables.
As you can see, I have 2 entrypoints: web and websecure. And on my target service (whoami) I've configured both those entrypoints: traefik.http.routers.whoami.entrypoints: web,websecure. I've seen here, that somebody uses different routers for http and https, but this way of configuring seems weird: Traefik supports configuring multiple comma-separated entrypoints for same router, and it even shows them in UI:

It works almost fine, especially for HTTPS, BUT if I'll try to open it the same resource via HTTP, it results in 404 page not found
Example:
- Try to open
https://monitor.MYDOMAIN, and it successfully proxying traffic - Try to open
http://monitor.MYDOMAIN, and it will show404 page not found
This problem is not only appears for Traefik Dashboard, but for any type of router, whoami and any other mine projects
If Traefik supports configuring multiple entrypoints for same router, I expect it to work from both those entrypoints