diff --git a/apache/lib/common b/apache/lib/common index 73247e8..617b50b 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -678,9 +678,13 @@ target-get() { } __vhost_proxy_statement() { - local protocol="$1" cfg="$2" dest="$3" + local protocol="$1" cfg="$2" dest="$3" proxy_pass_options target target=$(target-get "$cfg") || return 1 + proxy_pass_options=($(e "$cfg" | shyaml -y -q get-value apache-proxy-pass-options | yaml_get_values)) + if [ "${#proxy_pass_options[@]}" == 0 ]; then + proxy_pass_options=(${proxy_pass_options:-"retry=0"}) + fi cat < ProxyVia On - ProxyPass / http://$target/ retry=0 + ProxyPass / http://$target/ ${proxy_pass_options[*]} $(__vhost_creds_statement "$cfg" "$dest" | prefix " ") ProxyPassReverse / diff --git a/apache/test/vhost b/apache/test/vhost index 58e150d..ebcd4f7 100644 --- a/apache/test/vhost +++ b/apache/test/vhost @@ -172,6 +172,16 @@ is out part ' ' + +try " +apache_vhost_statement web_proxy ,http, ' +target: popo:3333 +apache-proxy-pass-options: nocanon +' www.example.com +" "proxy proxy-pass options" +noerror +is out reg 'ProxyPass / http://popo:3333/ nocanon' + ## ## ssl ##