Hi there,
using latest Traefik release and I am having some sites which are being served by traefik, this is working so far excellent.
Now I would like to have a redirect from when accessing a site e.g. HTTP 80 to HTTPS 442 .
As of I launch https://mysite:442 everything works as expected but as of I launch http://mysite:80 the redirect does not work.
Here is my traefik config:
version: "3.3"
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
networks:
- traefik_proxy
command:
- "--log.level=INFO"
#- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:442"
- "--certificatesresolvers.mydnschallenge.acme.dnschallenge=true"
- "--certificatesresolvers.mydnschallenge.acme.dnschallenge.provider=cloudflare"
#- "--certificatesresolvers.mydnschallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.mydnschallenge.acme.email=myemail@gmail.com"
- "--certificatesresolvers.mydnschallenge.acme.storage=/etc/traefik/acme/acme.json"
- "--providers.file.filename=/rules.yml"
- "--providers.file.watch=true"
ports:
- "80:80"
#- "8080:8080"
- "442:442"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik-web.rule=Host(`traefik.mysite.gq`)"
- "traefik.http.routers.traefik-web.entrypoints=websecure"
- "traefik.http.routers.traefik-web.tls.certresolver=mydnschallenge"
#- "traefik.http.services.traefik-web.loadbalancer.server.port=8080"
#- "traefik.http.routers.traefik-web.middlewares=auth"
- "traefik.http.routers.traefik-web.middlewares=traefik-auth"
- "traefik.http.routers.traefik-web.service=api@internal"
#- "traefik.http.middlewares.traefik-auth.basicauth.usersfile=/usersfile"
- "traefik.http.middlewares.traefik-auth.basicauth.users=admin:$blablablabla"
#middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
#global redirect
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=web"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"