diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf index 7ac85a607f..1f14730f51 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf @@ -238,6 +238,22 @@ resource "kubernetes_manifest" "jupyterhub" { port = 80 } ] + }, + { + kind = "Rule" + match = "Host(`${var.external-url}`) && (PathPrefix(`/home`) || PathPrefix(`/token`) || PathPrefix(`/admin`))" + middlewares = [ + { + name = kubernetes_manifest.jupyterhub-middleware-addprefix.manifest.metadata.name + namespace = var.namespace + } + ] + services = [ + { + name = "proxy-public" + port = 80 + } + ] } ] } diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/middleware.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/middleware.tf new file mode 100644 index 0000000000..f09d0f3dfa --- /dev/null +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/middleware.tf @@ -0,0 +1,15 @@ +resource "kubernetes_manifest" "jupyterhub-middleware-addprefix" { + manifest = { + apiVersion = "traefik.containo.us/v1alpha1" + kind = "Middleware" + metadata = { + name = "nebari-jupyterhub-add-prefix" + namespace = var.namespace + } + spec = { + addPrefix = { + prefix = "/hub" + } + } + } +}