I'm migrating a very old 1.7 implementation that was doing the following:
- Upgrade
http-->https
- Rewrite
non-www
towww
I've got the http-->https
configured as a global redirect in traefik.yml
:
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
...and then have the redirect on the Docker container labels as...
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.domain.rule=Host(`www.domain.io`)"
- "traefik.http.routers.domain.entrypoints=https"
- "traefik.http.routers.domain.tls.domains[0].main=www.domain.io"
- "traefik.http.routers.domain.tls.domains[0].sans=domain.io"
- "traefik.http.routers.domain.tls=true"
- "traefik.http.routers.domain.tls.certresolver=cf"
- "traefik.http.routers.domain.middlewares=domain"
- 'traefik.http.middlewares.domain.redirectregex.regex=^https://domain.io/(.*)'
- 'traefik.http.middlewares.domain.redirectregex.replacement=https://www.domain.io/$${1}'
- "traefik.http.middlewares.domain.redirectregex.permanent=true"
Is this an ordering issue where the redirect has to happen before the HTTPS upgrade? Or what am I missing?
I can load the www.domain.io
just fine - and it's bumped to TLS if I try to request via HTTP. But when I try HTTP and HTTPS of the non-www I get a 404 back.
Thanks in advance!