add HTTPS redirection

This commit is contained in:
vincent 2022-05-09 08:50:17 +02:00
parent b1bac2bd9e
commit 93adbdb05a
2 changed files with 7 additions and 2 deletions

View File

@ -6,8 +6,8 @@ job "homeassistant" {
forcedeploy = "1"
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
attribute = "${attr.unique.hostname}"
value = "oscar"
}
group "homeassistant"{
@ -38,6 +38,7 @@ job "homeassistant" {
"traefik.enable=true",
"traefik.http.middlewares.httpsRedirect.redirectscheme.scheme=https",
"traefik.http.routers.${NOMAD_TASK_NAME}_insecure.middlewares=httpsRedirect",
"traefik.http.routers.${NOMAD_TASK_NAME}_insecure.rule=Host(`${NOMAD_TASK_NAME}.ducamps.win`)"
"traefik.http.routers.${NOMAD_TASK_NAME}.rule=Host(`${NOMAD_TASK_NAME}.ducamps.win`)",
"traefik.http.routers.${NOMAD_TASK_NAME}.tls.domains[0].sans=${NOMAD_TASK_NAME}.ducamps.win",
"traefik.http.routers.${NOMAD_TASK_NAME}.tls.certresolver=myresolver",

View File

@ -33,6 +33,10 @@ job "nextcloud" {
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`file.ducamps.win`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=file.ducamps.win",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.entrypoints=web",
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.rule=Host(`file.ducamps.win`)",
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.middlewares=httpsRedirect",
"traefik.http.middlewares.httpsRedirect.redirectscheme.scheme=https",
]