From 69553060bb8f550bf83d42f988151b36f2f12379 Mon Sep 17 00:00:00 2001 From: Stefano Ortolani Date: Fri, 11 Sep 2026 13:00:01 +0100 Subject: [PATCH] Improve base_url and ssl handling --- docker-compose.yml | 2 +- nginx/files/01-listen.sh | 7 +++++++ nginx/files/04-ssl.sh | 13 +++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e79dccc5..d4182ecb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -123,7 +123,7 @@ services: timeout: 1s retries: 3 start_period: 60s - start_interval: 30s + start_interval: 5s expose: - 9002 volumes: diff --git a/nginx/files/01-listen.sh b/nginx/files/01-listen.sh index 51168a8f..0528279b 100755 --- a/nginx/files/01-listen.sh +++ b/nginx/files/01-listen.sh @@ -16,6 +16,13 @@ if [ -f "/etc/nginx/certs/cert.pem" ] && [ -f "/etc/nginx/certs/key.pem" ]; then exit 1 ;; esac +else + case "$BASE_URL" in + https://*) + echo "BASE_URL starts with https://, but SSL certificate is NOT present. Please update your env variables!" + exit 1 + ;; + esac fi if [ -f "/etc/nginx/certs/cert.pem" ] && [ -f "/etc/nginx/certs/key.pem" ]; then diff --git a/nginx/files/04-ssl.sh b/nginx/files/04-ssl.sh index 867618d7..288e1ddf 100755 --- a/nginx/files/04-ssl.sh +++ b/nginx/files/04-ssl.sh @@ -13,13 +13,9 @@ if [ ! -f "/etc/nginx/certs/cert.pem" ] || [ ! -f "/etc/nginx/certs/key.pem" ]; exit 0 fi -# normalize redirect url -REDIRECT_URL=${BASE_URL#http://} -REDIRECT_URL=${REDIRECT_URL#https://} -REDIRECT_URL="https://${REDIRECT_URL}" - -# build redirect config -cat >> "$REDIRECT_CONF" <> "$REDIRECT_CONF" <> "$SSL_CONF" <