diff --git a/jobs/nginx/atlas.hcl b/jobs/nginx/atlas.hcl index 81c334c..7a072e0 100644 --- a/jobs/nginx/atlas.hcl +++ b/jobs/nginx/atlas.hcl @@ -27,12 +27,18 @@ job "atlas" { tags = [ "traefik.enable=true", - "traefik.http.routers.nginx-atlas.rule=Host(`redbrick.dcu.ie`) || Host(`rb.dcu.ie`)", + "traefik.http.routers.nginx-atlas.rule=Host(`redbrick.dcu.ie`) || Host(`www.redbrick.dcu.ie`) || Host(`www.rb.dcu.ie`) || Host(`rb.dcu.ie`)", "traefik.http.routers.nginx-atlas.entrypoints=web,websecure", "traefik.http.routers.nginx-atlas.tls.certresolver=lets-encrypt", - "traefik.http.routers.nginx-atlas.middlewares=redirect-user-web", + "traefik.http.routers.nginx-atlas.middlewares=atlas-www-redirect,redirect-user-web", + # redirect redbrick.dcu.ie/~user to user.redbrick.dcu.ie "traefik.http.middlewares.redirect-user-web.redirectregex.regex=https://redbrick\\.dcu\\.ie/~([^/]*)/?([^/].*)?", "traefik.http.middlewares.redirect-user-web.redirectregex.replacement=https://$1.redbrick.dcu.ie/$2", + "traefik.http.middlewares.redirect-user-web.redirectregex.permanent=true", + # redirect www.redbrick.dcu.ie to redbrick.dcu.ie + "traefik.http.middlewares.atlas-www-redirect.redirectregex.regex=^https?://www.redbrick.dcu.ie/(.*)", + "traefik.http.middlewares.atlas-www-redirect.redirectregex.replacement=https://redbrick.dcu.ie/$${1}", + "traefik.http.middlewares.atlas-www-redirect.redirectregex.permanent=true", ] }