From fd01a45081c87c2e2cfcfe35e93c57796eadd5e7 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 14 Mar 2012 16:15:20 +0100 Subject: [PATCH] Add support for RewriteRules and Redirect --- .../httpd/conf/httpd.conf/WebAppVirtualHost/50Content | 19 +++++++++++++++++++ smeserver-webapps-common.spec | 7 +++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content index f07676c..ff7f62a 100644 --- a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content @@ -1,16 +1,35 @@ { my $target = $domain->prop('ProxyPassTarget') || ''; +my $redirect = $domain->prop('Redirect') || ''; +my $rewrite = $domain->prop('Rewrite') || ''; my $allow = $domain->prop('AllowHosts') || ''; my $preserve = $domain->prop('ProxyPreserveHost') || 'no'; my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no'; +# ProxyPass ? if ($target =~ m|https?://[\d\w\.\-/]*|){ $OUT .= " SetEnv proxy-nokeepalive 1\n" if ($keepalive eq 'yes'); $OUT .= " ProxyPass / $target\n"; $OUT .= " ProxyPassReverse / $target\n"; $OUT .= " ProxyPreserveHost on\n" if ($preserve eq 'yes'); } +# Rewrite ? +elsif ($rewrite =~ m|https?://[\d\w\.\-/]*|){ + $OUT .="HERE"; + + RewriteRule /(.*|\$) $redirect/\$1 [L,R] + +HERE +} +# Redirect ? +elsif ($redirect =~ m|https?://[\d\w\.\-/]*|){ + $OUT .="HERE"; + + RedirectMatch permanent ^/(.*|\$) $redirect/\$1 + +HERE +} else{ my $root = $domain->prop('DocumentRoot') || '/home/e-smith/files/ibays/Primary/html'; diff --git a/smeserver-webapps-common.spec b/smeserver-webapps-common.spec index 855fd54..1465cad 100644 --- a/smeserver-webapps-common.spec +++ b/smeserver-webapps-common.spec @@ -5,8 +5,8 @@ Summary: Common WebApps Framework for SME Server %define name smeserver-webapps-common Name: %{name} -%define version 0.2.1 -%define release 1 +%define version 0.2.2 +%define release 1.beta0 Version: %{version} Release: %{release}%{?dist} License: GPL @@ -29,6 +29,9 @@ This package provide common files and events for Web Applications integration on SME Server %changelog +* Tue Mar 13 2012 Daniel Berteaud 0.2.2-1.sme +- Add support for RewriteRule or Redirect + * Tue Mar 13 2012 Daniel Berteaud 0.2.1-1.sme - Add ServerAlias support in WebAppVirtualHost