From 1ae631d374f9cdce6e7a1e40886a27c5cb781d12 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Fri, 18 Feb 2022 14:54:40 +0100 Subject: [PATCH] Redirect from Domain to www but with HTTPS --- www/docker-compose.yaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/www/docker-compose.yaml b/www/docker-compose.yaml index 3882ca9..bc2e015 100644 --- a/www/docker-compose.yaml +++ b/www/docker-compose.yaml @@ -11,10 +11,18 @@ services: restart: unless-stopped labels: - "traefik.enable=true" - - "traefik.http.routers.web-secure.entrypoints=websecure" - - "traefik.http.routers.web-secure.rule=Host(`${DOMAIN}`) || Host(`www.${DOMAIN}`)" - - "traefik.http.routers.web-secure.tls.certresolver=netcup" - - "traefik.http.routers.web-secure.tls.options=intermediate@file" + - "traefik.http.routers.webroot.entrypoints=websecure" # All HTTP requests are globally redirected to HTTPS + - "traefik.http.routers.webroot.rule=Host(`${DOMAIN}`)" + - "traefik.http.routers.webroot.tls.certresolver=netcup" + - "traefik.http.routers.webroot.tls.options=intermediate@file" + - "traefik.http.routers.webroot.middlewares=redirect-to-www" + - "traefik.http.middlewares.redirect-to-www.redirectregex.regex=^https?://florianzirker.de/(.*)" + - "traefik.http.middlewares.redirect-to-www.redirectregex.replacement=https://www.florianzirker.de/$${1}" + - "traefik.http.middlewares.redirect-to-www.redirectregex.permanent=true" + - "traefik.http.routers.www-secure.entrypoints=websecure" + - "traefik.http.routers.www-secure.rule=Host(`www.${DOMAIN}`)" + - "traefik.http.routers.www-secure.tls.certresolver=netcup" + - "traefik.http.routers.www-secure.tls.options=intermediate@file" - "docker.group=www" networks: