From 7f3e15f2af6e87a5a1d811de35840048df5935e9 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 22 Oct 2018 00:00:43 +0200 Subject: [PATCH] chg: [apache] custom rules are now before the content so as to add proxy rules if necessary --- apache/lib/common | 9 +++++---- apache/test/vhost | 40 ++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/apache/lib/common b/apache/lib/common index fec0174d..755ffe63 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -342,6 +342,7 @@ SSLCertificateKeyFile $__vhost_cfg_SSL_KEY_LOCATION $([ -z "$__vhost_cfg_SSL_CA_CERT_LOCATION" ] || echo "SSLCACertificateFile $__vhost_cfg_SSL_CA_CERT_LOCATION") $([ -z "$__vhost_cfg_SSL_CHAIN" ] || echo "SSLCertificateChainFile $__vhost_cfg_SSL_CHAIN") SSLVerifyClient None + EOF } @@ -430,6 +431,7 @@ __vhost_proxy_statement() { fi cat < -$(__vhost_head_statement "$protocol" | prefix " ") - +$(__vhost_head_statement "$protocol" | prefix " " && echo) +$(__vhost_custom_rules | prefix " " && echo) $(__vhost_content_statement "$protocol" | prefix " ") ## Forbid any cache, this is only usefull on dev server. @@ -481,8 +483,7 @@ $(__vhost_content_statement "$protocol" | prefix " ") #Header set Access-Control-Allow-Origin "*" #Header set Access-Control-Allow-Methods "POST, GET, OPTIONS" #Header set Access-Control-Allow-Headers "origin, content-type, accept" -$([ "$protocol" == "https" ] && __vhost_ssl_statement | prefix " ") -$(__vhost_custom_rules | prefix " ") +$([ "$protocol" == "https" ] && __vhost_ssl_statement | prefix " " && echo ) EOF diff --git a/apache/test/vhost b/apache/test/vhost index 35b1e8ed..41a39ea5 100644 --- a/apache/test/vhost +++ b/apache/test/vhost @@ -63,7 +63,6 @@ is out ' #Header set Access-Control-Allow-Methods "POST, GET, OPTIONS" #Header set Access-Control-Allow-Headers "origin, content-type, accept" - ' RTRIM ## @@ -239,6 +238,16 @@ is out ' ErrorLog /var/log/apache2/www.example.com_error.log ErrorLog syslog:local2 + + ## + ## Custom rules + ## + + RewriteEngine On + RewriteCond %{QUERY_STRING} !skin=formanoo + RewriteRule ^(/web/webclient/home.*)$ ?skin=formanoo [L,QSA,R=302] + + ## ## Proxy declaration towards popo:3333 ## @@ -269,16 +278,6 @@ is out ' #Header set Access-Control-Allow-Methods "POST, GET, OPTIONS" #Header set Access-Control-Allow-Headers "origin, content-type, accept" - - - ## - ## Custom rules - ## - - RewriteEngine On - RewriteCond %{QUERY_STRING} !skin=formanoo - RewriteRule ^(/web/webclient/home.*)$ ?skin=formanoo [L,QSA,R=302] - @@ -292,6 +291,16 @@ is out ' ErrorLog /var/log/apache2/s-www.example.com_error.log ErrorLog syslog:local2 + + ## + ## Custom rules + ## + + RewriteEngine On + RewriteCond %{QUERY_STRING} !skin=formanoo + RewriteRule ^(/web/webclient/home.*)$ ?skin=formanoo [L,QSA,R=302] + + ## ## Proxy declaration towards popo:3333 ## @@ -334,14 +343,5 @@ is out ' SSLVerifyClient None - - ## - ## Custom rules - ## - - RewriteEngine On - RewriteCond %{QUERY_STRING} !skin=formanoo - RewriteRule ^(/web/webclient/home.*)$ ?skin=formanoo [L,QSA,R=302] - ' RTRIM