I have now also tried https://docs.traefik.io/middlewares/redirectscheme/. It seems like the port redirection takes effect, but not the protocol one :
traefik.http.middlewares.mytest.redirectscheme.scheme: https
traefik.http.middlewares.mytest.redirectscheme.port: 8443
No difference if I add the permanent: true line as well (whatever "permanent" mean in this case...).
traefik.http.middlewares.mytest.redirectscheme.scheme: https
traefik.http.middlewares.mytest.redirectscheme.permanent: true
traefik.http.middlewares.mytest.redirectscheme.port: 8443
Neither if I quote "https" it works...
EDIT: After adding a lot of different labels it now at least looks to me like it is right - but still I get "404 page not found". Here is the docker compose file labels:
labels:
traefik.frontend.rule: "Host:mytest.${PROJECT_NAME}.${DOCKER_HOSTNAME}"
traefik.frontend.passHostHeader: "true"
traefik.frontend.entryPoints: http,https
traefik.frontend.redirect.entryPoint: "https"
traefik.port: "8080"
traefik.http.middlewares.main.redirectscheme.protocol: https
traefik.http.middlewares.main.redirectscheme.port: 8443
The traefik dashboard shows that the backend server is
https://192.168.208.11:8443
which is what I would expect. Even though the link URL I then click is
http://mytest.myproject.locahost/mytestpage
I do get "404 page not found"
If I try to access
https://192.168.208.11:8443/mytestpage
directly I do come to my page. What on earth is missing now?
(NOTE: I have a link http://myproject.localhost/ that is working fine (it does not include any redirection though), so I have got something right with Traefik at least. Here is my traefik docker service:
traefik:
restart: always
image: traefik:1.7.3-alpine
command: --debug --api --docker --docker.network=proxy
labels:
traefik.port: "8080"
traefik.frontend.rule: "Host:traefik.${DOCKER_HOSTNAME}"
ports:
- "${TRAEFIK_HTTP}:80"
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.toml:/etc/traefik/traefik.toml
TRAEFIK_HTTP=80
DOCKER_HOSTNAME=localhost
PROJECT_NAME=myproject
)