From 59f047bb453e029c16235a62959d144c5093768a Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 16 Dec 2014 12:15:10 -0800 Subject: [PATCH] include SSL_VHOSTS in NOSSL_SERVER_NAME so we can redirect from http to https on the secure hostname as well --- plugins/nginx-vhosts/commands | 5 ++--- plugins/nginx-vhosts/templates/nginx.ssl.conf | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 64f88f947..c961bc5f0 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -60,9 +60,8 @@ EOF fi cat $VHOST_PATH | xargs -i echo "-----> Configuring {}..." - NOSSL_SERVER_NAME=`echo $NONSSL_VHOSTS | tr '\n' ' '` - # if NOSSL_SERVER_NAME is just ' ' then set NOSSL_SERVER_NAME to SSL_HOSTNAME since we redirect anyway - [[ "$NOSSL_SERVER_NAME" = ' ' ]] && NOSSL_SERVER_NAME=$(echo $SSL_VHOSTS | tr '\n' ' ') + # Include SSL_VHOSTS so we can redirect http to https on that hostname as well + NOSSL_SERVER_NAME=`echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' '` echo "-----> Creating $SCHEME nginx.conf" echo "upstream $APP { server 127.0.0.1:$PORT; }" > $DOKKU_ROOT/$APP/nginx.conf diff --git a/plugins/nginx-vhosts/templates/nginx.ssl.conf b/plugins/nginx-vhosts/templates/nginx.ssl.conf index e30a6a82d..5cde7484a 100644 --- a/plugins/nginx-vhosts/templates/nginx.ssl.conf +++ b/plugins/nginx-vhosts/templates/nginx.ssl.conf @@ -2,7 +2,7 @@ server { listen [::]:80; listen 80; server_name $NOSSL_SERVER_NAME; - return 301 https://\$host\$request_uri; + return 301 https://$SSL_SERVER_NAME\$request_uri; } server {