From 5d47a6bad508372929f201d25ff0a836aa1226bb Mon Sep 17 00:00:00 2001 From: librelad Date: Fri, 22 May 2026 00:45:01 +0100 Subject: [PATCH] fix(routing): honour HOST_NAME for app subdomain; add @ apex hosting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HOST_NAME was read but ignored — the FQDN was built from app_name, so 8 apps (vault, cloud, search, notes, social, meet, board, bookmark) routed at the wrong host and Traefik disagreed with DNS. Build host_setup from HOST_NAME (falling back to app_name); treat HOST_NAME="@"/"root" as the domain apex (root-of-domain hosting, previously impossible). Document @ in the Hostname field tooltip. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- scripts/network/variables/variables_init_app.sh | 11 ++++++++++- .../categories/webui_create_app_field_mappings.sh | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/network/variables/variables_init_app.sh b/scripts/network/variables/variables_init_app.sh index 9515519..df5e9ad 100755 --- a/scripts/network/variables/variables_init_app.sh +++ b/scripts/network/variables/variables_init_app.sh @@ -35,7 +35,16 @@ initializeAppVariables() app_title="${!app_title_var}" domain_var_name="CFG_DOMAIN_${domain}" domain_full="${!domain_var_name}" - host_setup=${app_name}.${domain_full} + # FQDN for this app's Traefik Host() rule (also feeds the app URL and + # trusted-domains): + # HOST_NAME="@" or "root" -> (apex / root of domain) + # HOST_NAME set -> . (custom subdomain) + # HOST_NAME empty -> . (fallback default) + if [[ "$host_name" == "@" || "$host_name" == "root" ]]; then + host_setup="${domain_full}" + else + host_setup="${host_name:-$app_name}.${domain_full}" + fi ssl_key=${domain_full}.key ssl_crt=${domain_full}.crt diff --git a/scripts/webui/data/generators/categories/webui_create_app_field_mappings.sh b/scripts/webui/data/generators/categories/webui_create_app_field_mappings.sh index c4e896a..8e29f3a 100755 --- a/scripts/webui/data/generators/categories/webui_create_app_field_mappings.sh +++ b/scripts/webui/data/generators/categories/webui_create_app_field_mappings.sh @@ -83,8 +83,8 @@ webuiCreateAppFieldMappings() { "category": "network", "label": "Hostname", "type": "text", - "tooltip": "The hostname for this application", - "placeholder": "myapp" + "tooltip": "Subdomain this app is served on — e.g. myapp becomes myapp.yourdomain.com. Use @ to serve it on the root of your domain (yourdomain.com itself).", + "placeholder": "myapp · @ = root domain" }, "DOMAIN": { "category": "network",