include SSL_VHOSTS in NOSSL_SERVER_NAME so we can redirect from http to https on the secure hostname as well

This commit is contained in:
Michael Hobbs
2014-12-16 12:15:10 -08:00
parent 1b208778f3
commit 59f047bb45
2 changed files with 3 additions and 4 deletions

View File

@@ -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

View File

@@ -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 {