Global https redirect

Hi,
I tried to do a global http to https redirect like described here:

The redirect is working, but I only get 404 pages delivered now.
Help much appreciated.

part of trafik.yml:

api:
  dashboard: true

entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: ":443"

providers:
  docker:
    network: proxy

certificatesResolvers:
  letsencrypt:
    acme:
      email: mymail
      storage: acme.json
      tlsChallenge: {}
      # httpChallenge:
      #   entryPoint: http

pilot:
  token: "my token"

whoami compose file:

version: "3"

services: 
  whoami:
    # A container that exposes an API to show its IP address
    image: traefik/whoami
    container_name: whoami
    networks:
      - proxy
    labels:
      - traefik.http.routers.whoami.rule=Host(`whoami.example.de`)
      - traefik.http.routers.whoami.entrypoints=websecure
      - traefik.http.routers.whoami.tls=true
      - traefik.http.routers.whoami.tls.certresolver=letsencrypt

networks:
  proxy:
    external: true

traefik compose:

version: "3"

services:
  traefik:
    image: "traefik:${TAG}"
    container_name: traefik
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./config/traefik.yml:/traefik.yml
      - ./letsencrypt/acme.json:/acme.json
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      - proxy
      - default
    labels:
      # Dashboard
      - "traefik.http.routers.traefik.rule=Host(`traefik.example.de`)"
      - "traefik.http.routers.traefik.entrypoints=websecure"
      - "traefik.http.routers.traefik.service=api@internal"
      - "traefik.http.routers.traefik.middlewares=auth"
      - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
      # echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g
      - "traefik.http.middlewares.auth.basicauth.users=admin:mypass"

networks:
  proxy:
    external:
      name: proxy
  default:
    driver: bridge

UPDATE: updated config files

Hello @woldtwerk and thanks for your interest in Traefik.

To diagnose your problem we will need a little bit more information. Could you show us your complete static configuration and logs (in debug mode)?

Hi,
I updated the config files. I'll try do add the debug log

@jspdown I could actually resolve the issue with the debug log. I renamed my entrypoint and a docker-compose restart did not update the changes. I had to use docker-compose down and then start it again. Wasn't aware that restart doesn't rebuild :confused:
Thx for the help.

I've seen some other post with widely different approaches. I guess this feature is new? The above code is working perfectly now. Hope it helps others =)

Hi @woldtwerk

docker-compose does not detect the changes in your files, only in the compose file. docker-compose up --force-recreate works also.

New-ish. V2.2.0 release March time frame.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.