From de21fdb682822f32915c4dced3f5a5018101dc80 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 30 Sep 2026 14:22:42 +0000 Subject: [PATCH] fix(install): always set app.allowedHostnames so the app starts in production The shipped .env has no app.allowedHostnames line, so the previous sed was a silent no-op. Since the installer sets CI_ENVIRONMENT=production, the app then fails fast on first load (App.php throws when the whitelist is empty). Append the key if it's missing, or substitute it if present. --- scripts/install-ubuntu.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/install-ubuntu.sh b/scripts/install-ubuntu.sh index 97aa1d851..590417d29 100644 --- a/scripts/install-ubuntu.sh +++ b/scripts/install-ubuntu.sh @@ -393,7 +393,13 @@ systemctl restart apache2 # Host-header validation accepts the domain the site is actually served at. if [ -f "${OSPOS_DIR}/.env" ]; then ALLOWED_HOST="${SSL_DOMAIN:-$APACHE_SERVER_NAME}" - sed -i "s|app\.allowedHostnames = ''|app.allowedHostnames = '${ALLOWED_HOST}'|" "${OSPOS_DIR}/.env" + # The shipped .env has no app.allowedHostnames line, so a plain sed is a silent + # no-op and production then 500s on first load; append it if it's missing. + if grep -Eq "^[[:space:]]*app\.allowedHostnames[[:space:]]*=" "${OSPOS_DIR}/.env"; then + sed -i "s|app\.allowedHostnames = .*|app.allowedHostnames = '${ALLOWED_HOST}'|" "${OSPOS_DIR}/.env" + else + printf "\napp.allowedHostnames = '%s'\n" "$ALLOWED_HOST" >> "${OSPOS_DIR}/.env" + fi fi echo ""