From eae3d463df7f7c67279e329e9eef0aa81078b371 Mon Sep 17 00:00:00 2001 From: Turtle Kalus Date: Sun, 4 Dec 2016 18:49:25 -0800 Subject: [PATCH] Fix for dokku/dokku#2474 `SSL_SERVER_NAME` should contain items found in the ssl certs (E.G. CommonName and AltNames), but not already in the `NOSSL_SERVER_NAME` list. That will avoid the dups in the `nginx.conf` and kill the warning initially cited in dokku/dokku#2474 --- plugins/nginx-vhosts/functions | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8c88d9a48..c68d9aa66 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -272,7 +272,14 @@ nginx_build_config() { else local SSL_VHOSTS=$(< "$DOKKU_ROOT/HOSTNAME") fi - local SSL_SERVER_NAME=$(echo "$SSL_VHOSTS" | xargs) + local SSL_SERVER_NAME + local host + for host in $SSL_VHOSTS; do + # SSL_SERVER_NAME should only contain items not in NOSSL_SERVER_NAME + if [[ ! $NOSSL_SERVER_NAME =~ (^|[[:space:]])$host($|[[:space:]]) ]]; then + SSL_SERVER_NAME="${host}${SSL_SERVER_NAME:+ $SSL_SERVER_NAME}" + fi + done fi local NGINX_VERSION="$(nginx -v 2>&1 | cut -d'/' -f 2)"