From 75d73e64a02d36b7988b79cc6148a7eb2d46fe0f Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Thu, 22 Oct 2026 12:04:21 -0600 Subject: [PATCH] fix: route Collabora WOPI endpoints through office host --- bootstrap/edge/main.tf | 1 + bootstrap/edge/templates/default.conf.tftpl | 19 +++++++++++++++++++ bootstrap/edge/variables.tf | 5 +++++ infra/office/docker-compose.yml | 1 + lib/jeannie/env.sh | 1 + 5 files changed, 27 insertions(+) diff --git a/bootstrap/edge/main.tf b/bootstrap/edge/main.tf index 7e063ab..b71ea22 100644 --- a/bootstrap/edge/main.tf +++ b/bootstrap/edge/main.tf @@ -54,6 +54,7 @@ locals { office_server_name = local.office_server_name office_backend_host = var.office_backend_host office_backend_port = tostring(var.office_backend_port) + office_collabora_backend_port = tostring(var.office_collabora_backend_port) }) default_vcl = templatefile("${path.module}/templates/default.vcl.tftpl", { backend_host = var.backend_host diff --git a/bootstrap/edge/templates/default.conf.tftpl b/bootstrap/edge/templates/default.conf.tftpl index 6b2720a..4f1b784 100644 --- a/bootstrap/edge/templates/default.conf.tftpl +++ b/bootstrap/edge/templates/default.conf.tftpl @@ -220,6 +220,25 @@ server { client_max_body_size 2g; + # Collabora shares the office hostname; route its WOPI and WebSocket paths + # to the local Collabora backend while the root path remains Nextcloud. + location ~ ^/(browser|hosting|cool|lool)(/|$) { + proxy_pass http://${office_backend_host}:${office_collabora_backend_port}; + proxy_http_version 1.1; + proxy_buffering off; + proxy_request_buffering off; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-Port 443; + } + location / { proxy_pass http://${office_backend_host}:${office_backend_port}; proxy_http_version 1.1; diff --git a/bootstrap/edge/variables.tf b/bootstrap/edge/variables.tf index a10f519..7954858 100644 --- a/bootstrap/edge/variables.tf +++ b/bootstrap/edge/variables.tf @@ -163,6 +163,11 @@ variable "office_backend_port" { default = 8090 } +variable "office_collabora_backend_port" { + type = number + default = 9980 +} + # Matrix (isolated vhost + its own cert; does NOT touch shared current.crt) variable "matrix_enabled" { type = bool diff --git a/infra/office/docker-compose.yml b/infra/office/docker-compose.yml index 949a3d3..8126c8b 100644 --- a/infra/office/docker-compose.yml +++ b/infra/office/docker-compose.yml @@ -56,6 +56,7 @@ services: extra_params: >- --o:ssl.enable=false --o:ssl.termination=true + --o:server_name=${OFFICE_PUBLIC_HOST:-office.lab2025.duckdns.org} --o:welcome.enable=false --o:logging.level=warning ports: diff --git a/lib/jeannie/env.sh b/lib/jeannie/env.sh index 79c5ea5..d9e715a 100644 --- a/lib/jeannie/env.sh +++ b/lib/jeannie/env.sh @@ -290,6 +290,7 @@ export_homelab_inventory_tf_vars() { export_if_unset TF_VAR_office_server_name "${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}" export_if_unset TF_VAR_office_backend_host "${LAB_OFFICE_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}" export_if_unset TF_VAR_office_backend_port "${LAB_OFFICE_HTTP_PORT:-8090}" + export_if_unset TF_VAR_office_collabora_backend_port "${LAB_OFFICE_COLLABORA_PORT:-9980}" export_if_unset TF_VAR_jeannie_api_backend_host "${LAB_JEANNIE_API_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}" export_if_unset TF_VAR_jeannie_api_backend_port "${LAB_JEANNIE_API_BACKEND_PORT:-8787}" export_if_unset TF_VAR_gitops_repo_url "${LAB_GITOPS_REPO_URL:-}"