diff --git a/apache/lib/common b/apache/lib/common index 1a20dd8..006bff0 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -40,7 +40,7 @@ export -f apache_publish_dir apache_vhost_create () { - export APACHE_CONFIG_LOCATION="$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled" + export APACHE_CONFIG_LOCATION="$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled" vhost_statement SERVER_ALIAS=$(relation-get server-aliases 2>/dev/null) || true PROTOCOLS=$(__vhost_cfg_normalize_protocol) || return 1 @@ -51,8 +51,8 @@ apache_vhost_create () { read-0 SSL_PLUGIN_FUN SSL_CFG_VALUE SSL_CFG_OPTIONS < <(ssl_get_plugin_fun) || return 1 "$SSL_PLUGIN_FUN"_vars "$SSL_CFG_OPTIONS" "$SSL_CFG_VALUE" || return 1 fi - apache_vhost_statement "$PROTOCOLS" | - file_put "$APACHE_CONFIG_LOCATION/$prefix$DOMAIN.conf" || return 1 + vhost_statement=$(apache_vhost_statement "$PROTOCOLS") || return 1 + echo "$vhost_statement"| file_put "$APACHE_CONFIG_LOCATION/$prefix$DOMAIN.conf" || return 1 __vhost_cfg_creds_enabled=$(relation-get creds 2>/dev/null) || true if [ "$__vhost_cfg_creds_enabled" ]; then @@ -285,14 +285,15 @@ apache_vhost_statement() { export PROTOCOLS="$1" if is_protocol_enabled http; then - __vhost_full_vhost_statement http + __vhost_full_vhost_statement http || return 1 fi if is_protocol_enabled https; then - "$SSL_PLUGIN_FUN"_vars "$(_get_ssl_option_value 2>/dev/null)" + "$SSL_PLUGIN_FUN"_vars "$(_get_ssl_option_value 2>/dev/null)" || return 1 + vhost_statement=$(__vhost_full_vhost_statement https) || return 1 cat < -$(__vhost_full_vhost_statement https | prefix " ") +$(echo "$vhost_statement" | prefix " ") EOF fi @@ -476,9 +477,9 @@ EOF __vhost_content_statement() { if [ "$proxy" ]; then - __vhost_proxy_statement "$@" + __vhost_proxy_statement "$@" || return 1 else - __vhost_publish_dir_statement "$@" + __vhost_publish_dir_statement "$@" || return 1 fi } @@ -500,6 +501,7 @@ __vhost_proxy_statement() { cat < -$(__vhost_head_statement "$protocol" | prefix " " && echo) -$(__vhost_custom_rules | prefix " " && echo) -$(__vhost_content_statement "$protocol" | prefix " ") +$(echo "$head_statement" | prefix " ") +$(echo "$custom_rules" | prefix " ") +$(echo "$content_statement" | prefix " ") ## Forbid any cache, this is only usefull on dev server. #Header set Cache-Control "no-cache" diff --git a/apache/test/vhost b/apache/test/vhost index aa4a364..a2d6287 100644 --- a/apache/test/vhost +++ b/apache/test/vhost @@ -56,7 +56,6 @@ is out ' Allow from all - ## Forbid any cache, this is only usefull on dev server. #Header set Cache-Control "no-cache" #Header set Access-Control-Allow-Origin "*" diff --git a/apache/test/vhost_cert_provider b/apache/test/vhost_cert_provider index 6373db9..7b0209d 100644 --- a/apache/test/vhost_cert_provider +++ b/apache/test/vhost_cert_provider @@ -142,4 +142,3 @@ is out part 'config-add | $MASTER_TARGET_SERVICE_NAME: | volumes: | - $DATASTORE/foo/etc/letsencrypt:/etc/letsencrypt:ro' -